summaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-httpd_management_wire_fees.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-12-04 20:29:18 +0100
committerChristian Grothoff <christian@grothoff.org>2020-12-04 20:29:18 +0100
commit6cceb617af887df49df74729bb1813bbd75a1346 (patch)
tree867616e235e6a1d84790f6c7c73f60900cbe2bb7 /src/exchange/taler-exchange-httpd_management_wire_fees.c
parent9b290fb26b2d18725858508bc14ae0933fff0250 (diff)
downloadexchange-6cceb617af887df49df74729bb1813bbd75a1346.tar.gz
exchange-6cceb617af887df49df74729bb1813bbd75a1346.tar.bz2
exchange-6cceb617af887df49df74729bb1813bbd75a1346.zip
centralize (most) offline signing/verifying operations into offline_signatures.c
Diffstat (limited to 'src/exchange/taler-exchange-httpd_management_wire_fees.c')
-rw-r--r--src/exchange/taler-exchange-httpd_management_wire_fees.c45
1 files changed, 16 insertions, 29 deletions
diff --git a/src/exchange/taler-exchange-httpd_management_wire_fees.c b/src/exchange/taler-exchange-httpd_management_wire_fees.c
index 58f2c41d..9878821c 100644
--- a/src/exchange/taler-exchange-httpd_management_wire_fees.c
+++ b/src/exchange/taler-exchange-httpd_management_wire_fees.c
@@ -221,36 +221,23 @@ TEH_handler_management_post_wire_fees (
TEH_currency);
}
+ if (GNUNET_OK !=
+ TALER_exchange_offline_wire_fee_verify (
+ afc.wire_method,
+ afc.start_time,
+ afc.end_time,
+ &afc.wire_fee,
+ &afc.closing_fee,
+ &TEH_master_public_key,
+ &afc.master_sig))
{
- struct TALER_MasterWireFeePS wf = {
- .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_WIRE_FEES),
- .purpose.size = htonl (sizeof (wf)),
- .start_date = GNUNET_TIME_absolute_hton (afc.start_time),
- .end_date = GNUNET_TIME_absolute_hton (afc.end_time),
- };
-
- TALER_amount_hton (&wf.wire_fee,
- &afc.wire_fee);
- TALER_amount_hton (&wf.closing_fee,
- &afc.closing_fee);
- GNUNET_CRYPTO_hash (afc.wire_method,
- strlen (afc.wire_method) + 1,
- &wf.h_wire_method);
- if (GNUNET_OK !=
- GNUNET_CRYPTO_eddsa_verify (
- TALER_SIGNATURE_MASTER_WIRE_FEES,
- &wf,
- &afc.master_sig.eddsa_signature,
- &TEH_master_public_key.eddsa_pub))
- {
- /* signature invalid */
- GNUNET_break_op (0);
- return TALER_MHD_reply_with_error (
- connection,
- MHD_HTTP_FORBIDDEN,
- TALER_EC_EXCHANGE_MANAGEMENT_WIRE_FEE_SIGNATURE_INVALID,
- NULL);
- }
+ /* signature invalid */
+ GNUNET_break_op (0);
+ return TALER_MHD_reply_with_error (
+ connection,
+ MHD_HTTP_FORBIDDEN,
+ TALER_EC_EXCHANGE_MANAGEMENT_WIRE_FEE_SIGNATURE_INVALID,
+ NULL);
}
qs = TEH_DB_run_transaction (connection,