diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-03-04 14:07:23 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-03-04 14:07:23 +0000 |
commit | fc646798891d075673e2ad8f2011c1e15160b6c1 (patch) | |
tree | 8e39b151eb710c1b7adcef75e47942f335565a44 /src/include | |
parent | 6a9425ddc6fa5de32bb97f05b46ab47c01106f80 (diff) | |
download | gnunet-fc646798891d075673e2ad8f2011c1e15160b6c1.tar.gz gnunet-fc646798891d075673e2ad8f2011c1e15160b6c1.zip |
-adding conversion of public key to string and back
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_crypto_lib.h | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h index 640df8b0b..7224e84f8 100644 --- a/src/include/gnunet_crypto_lib.h +++ b/src/include/gnunet_crypto_lib.h | |||
@@ -86,7 +86,7 @@ enum GNUNET_CRYPTO_Quality | |||
86 | 86 | ||
87 | 87 | ||
88 | /** | 88 | /** |
89 | * Length of an RSA KEY (d,e,len), 2048 bit (=256 octests) key d, 2 byte e | 89 | * Length of an RSA KEY (n,e,len), 2048 bit (=256 octests) key n, 2 byte e |
90 | */ | 90 | */ |
91 | #define GNUNET_CRYPTO_RSA_KEY_LENGTH 258 | 91 | #define GNUNET_CRYPTO_RSA_KEY_LENGTH 258 |
92 | 92 | ||
@@ -761,6 +761,31 @@ GNUNET_CRYPTO_kdf (void *result, size_t out_len, const void *xts, | |||
761 | struct GNUNET_CRYPTO_RsaPrivateKey * | 761 | struct GNUNET_CRYPTO_RsaPrivateKey * |
762 | GNUNET_CRYPTO_rsa_key_create (void); | 762 | GNUNET_CRYPTO_rsa_key_create (void); |
763 | 763 | ||
764 | |||
765 | /** | ||
766 | * Convert a public key to a string. | ||
767 | * | ||
768 | * @param pub key to convert | ||
769 | * @return string representing 'pub' | ||
770 | */ | ||
771 | char * | ||
772 | GNUNET_CRYPTO_rsa_public_key_to_string (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *pub); | ||
773 | |||
774 | |||
775 | /** | ||
776 | * Convert a string representing a public key to a public key. | ||
777 | * | ||
778 | * @param enc encoded public key | ||
779 | * @param enclen number of bytes in enc (without 0-terminator) | ||
780 | * @param pub where to store the public key | ||
781 | * @return GNUNET_OK on success | ||
782 | */ | ||
783 | int | ||
784 | GNUNET_CRYPTO_rsa_public_key_from_string (const char *enc, | ||
785 | size_t enclen, | ||
786 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *pub); | ||
787 | |||
788 | |||
764 | /** | 789 | /** |
765 | * Encode the private key in a format suitable for | 790 | * Encode the private key in a format suitable for |
766 | * storing it into a file. | 791 | * storing it into a file. |