diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-03-15 16:39:06 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-03-15 16:39:06 +0100 |
commit | 53b189868edbc855240026c2a02fe6c4e53f9bb0 (patch) | |
tree | 6e8529155e75d0791f845784a98dbc7e6541cbed /src/util | |
parent | 76dda24c111c7316da36eba050b18494c6c83c56 (diff) |
moving low-level JSON encoding logic to json.c
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/json.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/util/json.c b/src/util/json.c index a9d6dc5cc..84fac4c98 100644 --- a/src/util/json.c +++ b/src/util/json.c @@ -151,6 +151,50 @@ TALER_JSON_from_ecdsa_sig (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpo /** + * Convert RSA public key to JSON. + * + * @param pk public key to convert + * @return corresponding JSON encoding + */ +json_t * +TALER_JSON_from_rsa_public_key (struct GNUNET_CRYPTO_rsa_PublicKey *pk) +{ + char *buf; + size_t buf_len; + json_t *ret; + + buf_len = GNUNET_CRYPTO_rsa_public_key_encode (pk, + &buf); + ret = TALER_JSON_from_data (buf, + buf_len); + GNUNET_free (buf); + return ret; +} + + +/** + * Convert RSA signature to JSON. + * + * @param sig signature to convert + * @return corresponding JSON encoding + */ +json_t * +TALER_JSON_from_rsa_signature (struct GNUNET_CRYPTO_rsa_Signature *sig) +{ + char *buf; + size_t buf_len; + json_t *ret; + + buf_len = GNUNET_CRYPTO_rsa_signature_encode (sig, + &buf); + ret = TALER_JSON_from_data (buf, + buf_len); + GNUNET_free (buf); + return ret; +} + + +/** * Convert binary data to a JSON string * with the base32crockford encoding. * |