aboutsummaryrefslogtreecommitdiff
path: root/src/util/crypto_rsa.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-07-08 20:48:24 +0000
committerChristian Grothoff <christian@grothoff.org>2015-07-08 20:48:24 +0000
commit57eb2ec3125dbbf60a9d1a2635ddc19345e2e5c1 (patch)
treebf33b5f8313e309634e2d61070ae99ab226f16d8 /src/util/crypto_rsa.c
parent728a40d587086cb9302f78347dd4d061083a424c (diff)
DEFAULTSERVICES is dead, remove remains
Diffstat (limited to 'src/util/crypto_rsa.c')
-rw-r--r--src/util/crypto_rsa.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/util/crypto_rsa.c b/src/util/crypto_rsa.c
index d1ca760cfa..58503b7341 100644
--- a/src/util/crypto_rsa.c
+++ b/src/util/crypto_rsa.c
@@ -527,6 +527,32 @@ GNUNET_CRYPTO_rsa_private_key_cmp (struct GNUNET_CRYPTO_rsa_PrivateKey *p1,
/**
+ * Obtain the length of the RSA key in bits.
+ *
+ * @param key the public key to introspect
+ * @return length of the key in bits
+ */
+unsigned int
+GNUNET_CRYPTO_rsa_public_key_len (const struct GNUNET_CRYPTO_rsa_PublicKey *key)
+{
+ gcry_mpi_t n;
+ int ret;
+ unsigned int rval;
+
+ ret = key_from_sexp (&n, key->sexp, "rsa", "n");
+ if (0 != ret)
+ {
+ /* this is no public RSA key */
+ GNUNET_break (0);
+ return 0;
+ }
+ rval = gcry_mpi_get_nbits (n);
+ gcry_mpi_release (n);
+ return rval;
+}
+
+
+/**
* Destroy a blinding key
*
* @param bkey the blinding key to destroy
@@ -549,7 +575,7 @@ GNUNET_CRYPTO_rsa_blinding_key_free (struct GNUNET_CRYPTO_rsa_BlindingKey *bkey)
*/
size_t
GNUNET_CRYPTO_rsa_blinding_key_encode (const struct GNUNET_CRYPTO_rsa_BlindingKey *bkey,
- char **buffer)
+ char **buffer)
{
size_t n;
char *b;