diff options
Diffstat (limited to 'src/util/gnunet-rsa.c')
-rw-r--r-- | src/util/gnunet-rsa.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/src/util/gnunet-rsa.c b/src/util/gnunet-rsa.c index 8fc79565a..61e1b66df 100644 --- a/src/util/gnunet-rsa.c +++ b/src/util/gnunet-rsa.c | |||
@@ -25,6 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_util_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | #include <gcrypt.h> | ||
28 | 29 | ||
29 | 30 | ||
30 | /** | 31 | /** |
@@ -44,6 +45,45 @@ static int print_short_identity; | |||
44 | 45 | ||
45 | 46 | ||
46 | /** | 47 | /** |
48 | * The private information of an RSA key pair. | ||
49 | * NOTE: this must match the definition in crypto_ksk.c and crypto_rsa.c! | ||
50 | */ | ||
51 | struct GNUNET_CRYPTO_RsaPrivateKey | ||
52 | { | ||
53 | gcry_sexp_t sexp; | ||
54 | }; | ||
55 | |||
56 | |||
57 | #if 0 | ||
58 | /** | ||
59 | * Create a new private key. Caller must free return value. | ||
60 | * | ||
61 | * @return fresh private key | ||
62 | */ | ||
63 | struct GNUNET_CRYPTO_RsaPrivateKey * | ||
64 | GNUNET_CRYPTO_rsa_key_create () | ||
65 | { | ||
66 | struct GNUNET_CRYPTO_RsaPrivateKey *ret; | ||
67 | gcry_sexp_t s_key; | ||
68 | gcry_sexp_t s_keyparam; | ||
69 | |||
70 | GNUNET_assert (0 == | ||
71 | gcry_sexp_build (&s_keyparam, NULL, | ||
72 | "(genkey(rsa(nbits %d)(rsa-use-e 3:257)))", | ||
73 | HOSTKEY_LEN)); | ||
74 | GNUNET_assert (0 == gcry_pk_genkey (&s_key, s_keyparam)); | ||
75 | gcry_sexp_release (s_keyparam); | ||
76 | #if EXTRA_CHECKS | ||
77 | GNUNET_assert (0 == gcry_pk_testkey (s_key)); | ||
78 | #endif | ||
79 | ret = GNUNET_malloc (sizeof (struct GNUNET_CRYPTO_RsaPrivateKey)); | ||
80 | ret->sexp = s_key; | ||
81 | return ret; | ||
82 | } | ||
83 | #endif | ||
84 | |||
85 | |||
86 | /** | ||
47 | * Main function that will be run by the scheduler. | 87 | * Main function that will be run by the scheduler. |
48 | * | 88 | * |
49 | * @param cls closure | 89 | * @param cls closure |
@@ -100,7 +140,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
100 | 140 | ||
101 | 141 | ||
102 | /** | 142 | /** |
103 | * The main function to obtain statistics in GNUnet. | 143 | * Program to manipulate RSA key files. |
104 | * | 144 | * |
105 | * @param argc number of arguments from the command line | 145 | * @param argc number of arguments from the command line |
106 | * @param argv command line arguments | 146 | * @param argv command line arguments |