diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/did/.gitignore | 2 | ||||
-rw-r--r-- | src/did/Makefile.am | 10 | ||||
-rw-r--r-- | src/did/test_w3c_ed25519_2020.c | 65 |
3 files changed, 77 insertions, 0 deletions
diff --git a/src/did/.gitignore b/src/did/.gitignore new file mode 100644 index 000000000..d47f720ff --- /dev/null +++ b/src/did/.gitignore | |||
@@ -0,0 +1,2 @@ | |||
1 | test_w3c_ed25519_2020 | ||
2 | gnunet-did | ||
diff --git a/src/did/Makefile.am b/src/did/Makefile.am index 21f210dd0..831197543 100644 --- a/src/did/Makefile.am +++ b/src/did/Makefile.am | |||
@@ -22,3 +22,13 @@ gnunet_did_LDADD = \ | |||
22 | -ljansson | 22 | -ljansson |
23 | 23 | ||
24 | 24 | ||
25 | check_PROGRAMS = \ | ||
26 | test_w3c_ed25519_2020 | ||
27 | |||
28 | test_w3c_ed25519_2020_SOURCES = \ | ||
29 | test_w3c_ed25519_2020.c | ||
30 | test_w3c_ed25519_2020_LDADD = \ | ||
31 | $(top_builddir)/src/util/libgnunetutil.la | ||
32 | |||
33 | |||
34 | |||
diff --git a/src/did/test_w3c_ed25519_2020.c b/src/did/test_w3c_ed25519_2020.c new file mode 100644 index 000000000..377dae2cd --- /dev/null +++ b/src/did/test_w3c_ed25519_2020.c | |||
@@ -0,0 +1,65 @@ | |||
1 | /* | ||
2 | Copyright (c) 2010 Jeffrey Burdges | ||
3 | |||
4 | Permission is hereby granted, free of charge, to any person obtaining a copy | ||
5 | of this software and associated documentation files (the "Software"), to deal | ||
6 | in the Software without restriction, including without limitation the rights | ||
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
8 | copies of the Software, and to permit persons to whom the Software is | ||
9 | furnished to do so, subject to the following conditions: | ||
10 | |||
11 | The above copyright notice and this permission notice shall be included in | ||
12 | all copies or substantial portions of the Software. | ||
13 | |||
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
20 | THE SOFTWARE. | ||
21 | */ | ||
22 | |||
23 | /** | ||
24 | * @file src/did/test_w3c_ed25519_2020.c | ||
25 | * @brief Testcases for the w3c Ed25519 formats for SSIs https://w3c-ccg.github.io/lds-ed25519-2020 | ||
26 | * @author Martin Schanzenbach | ||
27 | */ | ||
28 | |||
29 | #include "platform.h" | ||
30 | #include "gnunet_crypto_lib.h" | ||
31 | |||
32 | static char test_privkey[32] = { | ||
33 | 0x9b, 0x93, 0x7b, 0x81, 0x32, 0x2d, 0x81, 0x6c, | ||
34 | 0xfa, 0xb9, 0xd5, 0xa3, 0xba, 0xac, 0xc9, 0xb2, | ||
35 | 0xa5, 0xfe, 0xbe, 0x4b, 0x14, 0x9f, 0x12, 0x6b, | ||
36 | 0x36, 0x30, 0xf9, 0x3a, 0x29, 0x52, 0x70, 0x17 | ||
37 | }; | ||
38 | |||
39 | static char *targetPrivateKeyMultibase = "zrv3kJcnBP1RpYmvNZ9jcYpKBZg41iSobWxSg3ix2U7Cp59kjwQFCT4SZTgLSL3HP8iGMdJs3nedjqYgNn6ZJmsmjRm"; | ||
40 | |||
41 | static char *targetPublicKeyMultibase = "z6Mkf5rGMoatrSj1f4CyvuHBeXJELe9RPdzo2PKGNCKVtZxP"; | ||
42 | |||
43 | int | ||
44 | main () | ||
45 | { | ||
46 | struct GNUNET_CRYPTO_EddsaPrivateKey privkey; | ||
47 | struct GNUNET_CRYPTO_EddsaPublicKey pubkey; | ||
48 | char *privateKeyMultibase; | ||
49 | char *publicKeyMultibase; | ||
50 | |||
51 | memcpy (&privkey, test_privkey, sizeof (privkey)); | ||
52 | GNUNET_CRYPTO_eddsa_key_get_public (&privkey, &pubkey); | ||
53 | |||
54 | // FIXME convert pubkey to target | ||
55 | publicKeyMultibase = "FIXME"; | ||
56 | GNUNET_assert (0 == strcmp (targetPublicKeyMultibase, | ||
57 | publicKeyMultibase)); | ||
58 | |||
59 | // FIXME | ||
60 | privateKeyMultibase = "FIXME"; | ||
61 | GNUNET_assert (0 == strcmp (targetPrivateKeyMultibase, | ||
62 | privateKeyMultibase)); | ||
63 | |||
64 | return 0; | ||
65 | } | ||