diff options
Diffstat (limited to 'src/include/gnunet_crypto_lib.h')
-rw-r--r-- | src/include/gnunet_crypto_lib.h | 54 |
1 files changed, 45 insertions, 9 deletions
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h index 33842fc27..b73d26d1e 100644 --- a/src/include/gnunet_crypto_lib.h +++ b/src/include/gnunet_crypto_lib.h | |||
@@ -860,15 +860,6 @@ GNUNET_CRYPTO_kdf (void *result, size_t out_len, const void *xts, | |||
860 | 860 | ||
861 | 861 | ||
862 | /** | 862 | /** |
863 | * Create a new private key. Caller must free return value. | ||
864 | * | ||
865 | * @return fresh private key | ||
866 | */ | ||
867 | struct GNUNET_CRYPTO_RsaPrivateKey * | ||
868 | GNUNET_CRYPTO_rsa_key_create (void); | ||
869 | |||
870 | |||
871 | /** | ||
872 | * Convert a public key to a string. | 863 | * Convert a public key to a string. |
873 | * | 864 | * |
874 | * @param pub key to convert | 865 | * @param pub key to convert |
@@ -925,12 +916,57 @@ GNUNET_CRYPTO_rsa_decode_key (const char *buf, uint16_t len); | |||
925 | * @param filename name of file to use for storage | 916 | * @param filename name of file to use for storage |
926 | * @return new private key, NULL on error (for example, | 917 | * @return new private key, NULL on error (for example, |
927 | * permission denied) | 918 | * permission denied) |
919 | * @deprecated use 'GNUNET_CRYPTO_rsa_key_create_start' instead | ||
928 | */ | 920 | */ |
929 | struct GNUNET_CRYPTO_RsaPrivateKey * | 921 | struct GNUNET_CRYPTO_RsaPrivateKey * |
930 | GNUNET_CRYPTO_rsa_key_create_from_file (const char *filename); | 922 | GNUNET_CRYPTO_rsa_key_create_from_file (const char *filename); |
931 | 923 | ||
932 | 924 | ||
933 | /** | 925 | /** |
926 | * Handle to cancel private key generation. | ||
927 | */ | ||
928 | struct GNUNET_CRYPTO_RsaKeyGenerationContext; | ||
929 | |||
930 | |||
931 | /** | ||
932 | * Function called upon completion of 'GNUNET_CRYPTO_rsa_key_create_async'. | ||
933 | * | ||
934 | * @param cls closure | ||
935 | * @param pk NULL on error, otherwise the private key (which must be free'd by the callee) | ||
936 | * @param emsg NULL on success, otherwise an error message | ||
937 | */ | ||
938 | typedef void (*GNUNET_CRYPTO_RsaKeyCallback)(void *cls, | ||
939 | struct GNUNET_CRYPTO_RsaPrivateKey *pk, | ||
940 | const char *emsg); | ||
941 | |||
942 | |||
943 | /** | ||
944 | * Create a new private key by reading it from a file. If the files | ||
945 | * does not exist, create a new key and write it to the file. If the | ||
946 | * contents of the file are invalid the old file is deleted and a | ||
947 | * fresh key is created. | ||
948 | * | ||
949 | * @param filename name of file to use for storage | ||
950 | * @param cont function to call when done (or on errors) | ||
951 | * @param cont_cls closure for 'cont' | ||
952 | * @return handle to abort operation, NULL on fatal errors (cont will not be called if NULL is returned) | ||
953 | */ | ||
954 | struct GNUNET_CRYPTO_RsaKeyGenerationContext * | ||
955 | GNUNET_CRYPTO_rsa_key_create_start (const char *filename, | ||
956 | GNUNET_CRYPTO_RsaKeyCallback cont, | ||
957 | void *cont_cls); | ||
958 | |||
959 | |||
960 | /** | ||
961 | * Abort RSA key generation. | ||
962 | * | ||
963 | * @param gc key generation context to abort | ||
964 | */ | ||
965 | void | ||
966 | GNUNET_CRYPTO_rsa_key_create_stop (struct GNUNET_CRYPTO_RsaKeyGenerationContext *gc); | ||
967 | |||
968 | |||
969 | /** | ||
934 | * Setup a hostkey file for a peer given the name of the | 970 | * Setup a hostkey file for a peer given the name of the |
935 | * configuration file (!). This function is used so that | 971 | * configuration file (!). This function is used so that |
936 | * at a later point code can be certain that reading a | 972 | * at a later point code can be certain that reading a |