From 96b4c139ee9997f827e9559a186c9684a5978f4b Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 16 Dec 2020 12:56:35 +0100 Subject: add auditor-enable /-disable commands to taler-exchange-offline tool --- .../taler-exchange-httpd_management_auditors.c | 38 ++++++++-------------- ...exchange-httpd_management_auditors_AP_disable.c | 34 +++++++------------ 2 files changed, 25 insertions(+), 47 deletions(-) (limited to 'src/exchange') diff --git a/src/exchange/taler-exchange-httpd_management_auditors.c b/src/exchange/taler-exchange-httpd_management_auditors.c index acb8f2c58..6d700d612 100644 --- a/src/exchange/taler-exchange-httpd_management_auditors.c +++ b/src/exchange/taler-exchange-httpd_management_auditors.c @@ -176,32 +176,20 @@ TEH_handler_management_auditors ( if (GNUNET_NO == res) return MHD_YES; /* failure */ } + if (GNUNET_OK != + TALER_exchange_offline_auditor_add_verify ( + &aac.auditor_pub, + aac.auditor_url, + aac.validity_start, + &TEH_master_public_key, + &aac.master_sig)) { - struct TALER_MasterAddAuditorPS aa = { - .purpose.purpose = htonl ( - TALER_SIGNATURE_MASTER_ADD_AUDITOR), - .purpose.size = htonl (sizeof (aa)), - .start_date = GNUNET_TIME_absolute_hton (aac.validity_start), - .auditor_pub = aac.auditor_pub - }; - - GNUNET_CRYPTO_hash (aac.auditor_url, - strlen (aac.auditor_url) + 1, - &aa.h_auditor_url); - if (GNUNET_OK != - GNUNET_CRYPTO_eddsa_verify ( - TALER_SIGNATURE_MASTER_ADD_AUDITOR, - &aa, - &aac.master_sig.eddsa_signature, - &TEH_master_public_key.eddsa_pub)) - { - GNUNET_break_op (0); - return TALER_MHD_reply_with_error ( - connection, - MHD_HTTP_FORBIDDEN, - TALER_EC_EXCHANGE_MANAGEMENT_AUDITOR_ADD_SIGNATURE_INVALID, - NULL); - } + GNUNET_break_op (0); + return TALER_MHD_reply_with_error ( + connection, + MHD_HTTP_FORBIDDEN, + TALER_EC_EXCHANGE_MANAGEMENT_AUDITOR_ADD_SIGNATURE_INVALID, + NULL); } qs = TEH_DB_run_transaction (connection, diff --git a/src/exchange/taler-exchange-httpd_management_auditors_AP_disable.c b/src/exchange/taler-exchange-httpd_management_auditors_AP_disable.c index 222af60ec..eba392a00 100644 --- a/src/exchange/taler-exchange-httpd_management_auditors_AP_disable.c +++ b/src/exchange/taler-exchange-httpd_management_auditors_AP_disable.c @@ -165,29 +165,19 @@ TEH_handler_management_auditors_AP_disable ( if (GNUNET_NO == res) return MHD_YES; /* failure */ } + if (GNUNET_OK != + TALER_exchange_offline_auditor_del_verify ( + auditor_pub, + dac.validity_end, + &TEH_master_public_key, + &master_sig)) { - struct TALER_MasterDelAuditorPS da = { - .purpose.purpose = htonl ( - TALER_SIGNATURE_MASTER_DEL_AUDITOR), - .purpose.size = htonl (sizeof (da)), - .end_date = GNUNET_TIME_absolute_hton (dac.validity_end), - .auditor_pub = *auditor_pub - }; - - if (GNUNET_OK != - GNUNET_CRYPTO_eddsa_verify ( - TALER_SIGNATURE_MASTER_DEL_AUDITOR, - &da, - &master_sig.eddsa_signature, - &TEH_master_public_key.eddsa_pub)) - { - GNUNET_break_op (0); - return TALER_MHD_reply_with_error ( - connection, - MHD_HTTP_FORBIDDEN, - TALER_EC_EXCHANGE_MANAGEMENT_AUDITOR_DEL_SIGNATURE_INVALID, - NULL); - } + GNUNET_break_op (0); + return TALER_MHD_reply_with_error ( + connection, + MHD_HTTP_FORBIDDEN, + TALER_EC_EXCHANGE_MANAGEMENT_AUDITOR_DEL_SIGNATURE_INVALID, + NULL); } qs = TEH_DB_run_transaction (connection, -- cgit v1.2.3