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/mint/taler-mint-httpd_responses.c | |
parent | 76dda24c111c7316da36eba050b18494c6c83c56 (diff) |
moving low-level JSON encoding logic to json.c
Diffstat (limited to 'src/mint/taler-mint-httpd_responses.c')
-rw-r--r-- | src/mint/taler-mint-httpd_responses.c | 38 |
1 files changed, 8 insertions, 30 deletions
diff --git a/src/mint/taler-mint-httpd_responses.c b/src/mint/taler-mint-httpd_responses.c index dc51dee4b..1a0a7c997 100644 --- a/src/mint/taler-mint-httpd_responses.c +++ b/src/mint/taler-mint-httpd_responses.c @@ -581,15 +581,9 @@ TALER_MINT_reply_withdraw_sign_success (struct MHD_Connection *connection, const struct CollectableBlindcoin *collectable) { json_t *sig_json; - size_t sig_buf_size; - char *sig_buf; int ret; - sig_buf_size = GNUNET_CRYPTO_rsa_signature_encode (collectable->sig, - &sig_buf); - sig_json = TALER_JSON_from_data (sig_buf, - sig_buf_size); - GNUNET_free (sig_buf); + sig_json = TALER_JSON_from_rsa_signature (collectable->sig); ret = TALER_MINT_reply_json_pack (connection, MHD_HTTP_OK, "{s:o}", @@ -691,22 +685,14 @@ TALER_MINT_reply_refresh_reveal_success (struct MHD_Connection *connection, int newcoin_index; json_t *root; json_t *list; - char *buf; - size_t buf_size; int ret; root = json_object (); list = json_array (); json_object_set_new (root, "ev_sigs", list); for (newcoin_index = 0; newcoin_index < num_newcoins; newcoin_index++) - { - buf_size = GNUNET_CRYPTO_rsa_signature_encode (sigs[newcoin_index], - &buf); json_array_append_new (list, - TALER_JSON_from_data (buf, - buf_size)); - GNUNET_free (buf); - } + TALER_JSON_from_rsa_signature (sigs[newcoin_index])); ret = TALER_MINT_reply_json (connection, root, MHD_HTTP_OK); @@ -772,26 +758,18 @@ TALER_MINT_reply_refresh_link_success (struct MHD_Connection *connection, for (pos = ldl; NULL != pos; pos = pos->next) { json_t *obj; - char *buf; - size_t buf_len; obj = json_object (); json_object_set_new (obj, "link_enc", TALER_JSON_from_data (ldl->link_data_enc->coin_priv_enc, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey) + ldl->link_data_enc->blinding_key_enc_size)); - buf_len = GNUNET_CRYPTO_rsa_public_key_encode (ldl->denom_pub, - &buf); - json_object_set_new (obj, "denom_pub", - TALER_JSON_from_data (buf, - buf_len)); - GNUNET_free (buf); - buf_len = GNUNET_CRYPTO_rsa_signature_encode (ldl->ev_sig, - &buf); - json_object_set_new (obj, "ev_sig", - TALER_JSON_from_data (buf, - buf_len)); - GNUNET_free (buf); + json_object_set_new (obj, + "denom_pub", + TALER_JSON_from_rsa_public_key (ldl->denom_pub)); + json_object_set_new (obj, + "ev_sig", + TALER_JSON_from_rsa_signature (ldl->ev_sig)); json_array_append_new (list, obj); } |