aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_crypto_lib.h
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-02-29 19:21:20 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-02-29 19:21:20 +0000
commite2eb1cbf30d6f59d9ad94e104317b245ef9b1d56 (patch)
treee4e4b8a6f03f5cff579ca093a333ca4a7a353591 /src/include/gnunet_crypto_lib.h
parent46ba82641c0feb4b04ff489038543e576a0c78ee (diff)
downloadgnunet-e2eb1cbf30d6f59d9ad94e104317b245ef9b1d56.tar.gz
gnunet-e2eb1cbf30d6f59d9ad94e104317b245ef9b1d56.zip
serialize privat key
Diffstat (limited to 'src/include/gnunet_crypto_lib.h')
-rw-r--r--src/include/gnunet_crypto_lib.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h
index 63d3ee418..3d2c946b0 100644
--- a/src/include/gnunet_crypto_lib.h
+++ b/src/include/gnunet_crypto_lib.h
@@ -101,6 +101,32 @@ enum GNUNET_CRYPTO_Quality
101 */ 101 */
102struct GNUNET_CRYPTO_RsaPrivateKey; 102struct GNUNET_CRYPTO_RsaPrivateKey;
103 103
104GNUNET_NETWORK_STRUCT_BEGIN
105
106/**
107 * GNUnet mandates a certain format for the encoding
108 * of private RSA key information that is provided
109 * by the RSA implementations. This format is used
110 * to serialize a private RSA key (typically when
111 * writing it to disk).
112 */
113struct GNUNET_CRYPTO_RsaPrivateKeyBinaryEncoded
114{
115 /**
116 * Total size of the structure, in bytes, in big-endian!
117 */
118 uint16_t len GNUNET_PACKED;
119 uint16_t sizen GNUNET_PACKED; /* in big-endian! */
120 uint16_t sizee GNUNET_PACKED; /* in big-endian! */
121 uint16_t sized GNUNET_PACKED; /* in big-endian! */
122 uint16_t sizep GNUNET_PACKED; /* in big-endian! */
123 uint16_t sizeq GNUNET_PACKED; /* in big-endian! */
124 uint16_t sizedmp1 GNUNET_PACKED; /* in big-endian! */
125 uint16_t sizedmq1 GNUNET_PACKED; /* in big-endian! */
126 /* followed by the actual values */
127};
128GNUNET_NETWORK_STRUCT_END
129
104 130
105/** 131/**
106 * @brief 0-terminated ASCII encoding of a GNUNET_HashCode. 132 * @brief 0-terminated ASCII encoding of a GNUNET_HashCode.
@@ -736,6 +762,15 @@ struct GNUNET_CRYPTO_RsaPrivateKey *
736GNUNET_CRYPTO_rsa_key_create (void); 762GNUNET_CRYPTO_rsa_key_create (void);
737 763
738/** 764/**
765 * Encode the private key in a format suitable for
766 * storing it into a file.
767 * @returns encoding of the private key.
768 * The first 4 bytes give the size of the array, as usual.
769 */
770struct GNUNET_CRYPTO_RsaPrivateKeyBinaryEncoded *
771GNUNET_CRYPTO_rsa_encode_key (const struct GNUNET_CRYPTO_RsaPrivateKey *hostkey);
772
773/**
739 * Decode the private key from the data-format back 774 * Decode the private key from the data-format back
740 * to the "normal", internal format. 775 * to the "normal", internal format.
741 * 776 *