summaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-httpd_responses.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-05-25 20:52:58 +0200
committerChristian Grothoff <christian@grothoff.org>2021-05-25 20:52:58 +0200
commit0d1ab614c06f60f79de75a0f2ec30c33a69820dd (patch)
tree3776ec42d7bd6ed64b3b71888b5a3fbafcb213ea /src/exchange/taler-exchange-httpd_responses.c
parentb2b1f88ab617ee9a01ac263b8b1c679f24277076 (diff)
downloadexchange-0d1ab614c06f60f79de75a0f2ec30c33a69820dd.tar.gz
exchange-0d1ab614c06f60f79de75a0f2ec30c33a69820dd.tar.bz2
exchange-0d1ab614c06f60f79de75a0f2ec30c33a69820dd.zip
return signed 404 statements for unknown denomination key hashes (#6889)
Diffstat (limited to 'src/exchange/taler-exchange-httpd_responses.c')
-rw-r--r--src/exchange/taler-exchange-httpd_responses.c51
1 files changed, 50 insertions, 1 deletions
diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c
index ea9729af..23407474 100644
--- a/src/exchange/taler-exchange-httpd_responses.c
+++ b/src/exchange/taler-exchange-httpd_responses.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014-2017 Taler Systems SA
+ Copyright (C) 2014-2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free Software
@@ -417,6 +417,55 @@ TEH_RESPONSE_compile_transaction_history (
}
+MHD_RESULT
+TEH_RESPONSE_reply_unknown_denom_pub_hash (
+ struct MHD_Connection *connection,
+ const struct GNUNET_HashCode *dph)
+{
+ struct TALER_ExchangePublicKeyP epub;
+ struct TALER_ExchangeSignatureP esig;
+ struct GNUNET_TIME_Absolute now;
+ enum TALER_ErrorCode ec;
+
+ now = GNUNET_TIME_absolute_get ();
+ GNUNET_TIME_round_abs (&now);
+ {
+ struct TALER_DenominationUnknownAffirmationPS dua = {
+ .purpose.size = htonl (sizeof (dua)),
+ .purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_AFFIRM_DENOM_UNKNOWN),
+ .timestamp = GNUNET_TIME_absolute_hton (now),
+ .h_denom_pub = *dph,
+ };
+
+ ec = TEH_keys_exchange_sign (&dua,
+ &epub,
+ &esig);
+ }
+ if (TALER_EC_NONE != ec)
+ {
+ GNUNET_break (0);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ ec,
+ NULL);
+ }
+ return TALER_MHD_reply_json_pack (
+ connection,
+ MHD_HTTP_NOT_FOUND,
+ "{s:I,s:o,s:o,s:o,s:o}",
+ "code",
+ TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN,
+ "timestamp",
+ GNUNET_JSON_from_time_abs (now),
+ "exchange_pub",
+ GNUNET_JSON_from_data_auto (&epub),
+ "exchange_sig",
+ GNUNET_JSON_from_data_auto (&esig),
+ "h_denom_pub",
+ GNUNET_JSON_from_data_auto (dph));
+}
+
+
/**
* Send proof that a request is invalid to client because of
* insufficient funds. This function will create a message with all