From de9fdf860af9bdeadee4ed21a2c03dc34d58dd86 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 2 May 2019 21:16:51 +0200 Subject: replace denom_pub with denom_pub_hash in exchange API to reduce bandwidth --- src/lib/exchange_api_deposit.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/lib/exchange_api_deposit.c') diff --git a/src/lib/exchange_api_deposit.c b/src/lib/exchange_api_deposit.c index 3f72ad956..4033cc2ee 100644 --- a/src/lib/exchange_api_deposit.c +++ b/src/lib/exchange_api_deposit.c @@ -359,6 +359,7 @@ handle_deposit_finished (void *cls, * @param h_contract_terms hash of the contact of the merchant with the customer (further details are never disclosed to the exchange) * @param coin_pub coin’s public key * @param denom_pub denomination key with which the coin is signed + * @param denom_pub_hash hash of @a denom_pub * @param denom_sig exchange’s unblinded signature of the coin * @param timestamp timestamp when the deposit was finalized * @param merchant_pub the public key of the merchant (used to identify the merchant for refund requests) @@ -374,6 +375,7 @@ verify_signatures (const struct TALER_EXCHANGE_DenomPublicKey *dki, const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_DenominationSignature *denom_sig, const struct TALER_DenominationPublicKey *denom_pub, + const struct GNUNET_HashCode *denom_pub_hash, struct GNUNET_TIME_Absolute timestamp, const struct TALER_MerchantPublicKeyP *merchant_pub, struct GNUNET_TIME_Absolute refund_deadline, @@ -414,10 +416,11 @@ verify_signatures (const struct TALER_EXCHANGE_DenomPublicKey *dki, /* check coin signature */ coin_info.coin_pub = *coin_pub; - coin_info.denom_pub = *denom_pub; + coin_info.denom_pub_hash = *denom_pub_hash; coin_info.denom_sig = *denom_sig; if (GNUNET_YES != - TALER_test_coin_valid (&coin_info)) + TALER_test_coin_valid (&coin_info, + denom_pub)) { GNUNET_break_op (0); TALER_LOG_WARNING ("Invalid coin passed for /deposit\n"); @@ -489,6 +492,7 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange, json_t *deposit_obj; CURL *eh; struct GNUNET_HashCode h_wire; + struct GNUNET_HashCode denom_pub_hash; struct TALER_Amount amount_without_fee; (void) GNUNET_TIME_round_abs (&wire_deadline); @@ -512,6 +516,8 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange, TALER_amount_subtract (&amount_without_fee, amount, &dki->fee_deposit)); + GNUNET_CRYPTO_rsa_public_key_hash (denom_pub->rsa_public_key, + &denom_pub_hash); if (GNUNET_OK != verify_signatures (dki, amount, @@ -520,6 +526,7 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange, coin_pub, denom_sig, denom_pub, + &denom_pub_hash, timestamp, merchant_pub, refund_deadline, @@ -541,7 +548,7 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange, "H_wire", GNUNET_JSON_from_data_auto (&h_wire), "h_contract_terms", GNUNET_JSON_from_data_auto (h_contract_terms), "coin_pub", GNUNET_JSON_from_data_auto (coin_pub), - "denom_pub", GNUNET_JSON_from_rsa_public_key (denom_pub->rsa_public_key), + "denom_pub_hash", GNUNET_JSON_from_data_auto (&denom_pub_hash), "ub_sig", GNUNET_JSON_from_rsa_signature (denom_sig->rsa_signature), "timestamp", GNUNET_JSON_from_time_abs (timestamp), "merchant_pub", GNUNET_JSON_from_data_auto (merchant_pub), -- cgit v1.2.3