diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2015-05-28 19:32:22 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2015-05-28 19:32:22 +0000 |
commit | 3e558d2e9f22c96328d27e5cd35a5da3866e3543 (patch) | |
tree | 3ec605430e95e80c9568166d16d013ccffd6e528 /src/util/crypto_rsa.c | |
parent | 88b7ba683487b4bbb03fc4d51b5e794572816d9d (diff) | |
download | gnunet-3e558d2e9f22c96328d27e5cd35a5da3866e3543.tar.gz gnunet-3e558d2e9f22c96328d27e5cd35a5da3866e3543.zip |
Introduce function to duplicate RSA public keys
Diffstat (limited to 'src/util/crypto_rsa.c')
-rw-r--r-- | src/util/crypto_rsa.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/util/crypto_rsa.c b/src/util/crypto_rsa.c index 2aadf2fc4..0b21b40b4 100644 --- a/src/util/crypto_rsa.c +++ b/src/util/crypto_rsa.c | |||
@@ -801,6 +801,31 @@ GNUNET_CRYPTO_rsa_signature_decode (const char *buf, | |||
801 | 801 | ||
802 | 802 | ||
803 | /** | 803 | /** |
804 | * Duplicate the given public key | ||
805 | * | ||
806 | * @param key the public key to duplicate | ||
807 | * @return the duplicate key; NULL upon error | ||
808 | */ | ||
809 | struct GNUNET_CRYPTO_rsa_PublicKey * | ||
810 | GNUNET_CRYPTO_rsa_public_key_dup (const struct GNUNET_CRYPTO_rsa_PublicKey *key) | ||
811 | { | ||
812 | struct GNUNET_CRYPTO_rsa_PublicKey *dup; | ||
813 | gcry_sexp_t dup_sexp; | ||
814 | size_t erroff; | ||
815 | |||
816 | /* check if we really are exporting a public key */ | ||
817 | dup_sexp = gcry_sexp_find_token (key->sexp, "public-key", 0); | ||
818 | GNUNET_assert (NULL != dup_sexp); | ||
819 | gcry_sexp_release (dup_sexp); | ||
820 | /* copy the sexp */ | ||
821 | GNUNET_assert (0 == gcry_sexp_build (&dup_sexp, &erroff, "%S", key->sexp)); | ||
822 | dup = GNUNET_new (struct GNUNET_CRYPTO_rsa_PublicKey); | ||
823 | dup->sexp = dup_sexp; | ||
824 | return dup; | ||
825 | } | ||
826 | |||
827 | |||
828 | /** | ||
804 | * Unblind a blind-signed signature. The signature should have been generated | 829 | * Unblind a blind-signed signature. The signature should have been generated |
805 | * with #GNUNET_CRYPTO_rsa_sign() using a hash that was blinded with | 830 | * with #GNUNET_CRYPTO_rsa_sign() using a hash that was blinded with |
806 | * #GNUNET_CRYPTO_rsa_blind(). | 831 | * #GNUNET_CRYPTO_rsa_blind(). |