gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-exchange] branch master updated (69a8c16e -> 2024ccd


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] branch master updated (69a8c16e -> 2024ccd2)
Date: Sat, 27 Oct 2018 19:26:46 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a change to branch master
in repository exchange.

    from 69a8c16e finish first implementation of /version API call for the 
auditor
     new bfd8a6fa towards building auditor-lib (not yet finished)
     new 60fe2395 clean up  struct TALER_ExchangeSigningKeyValidityPS  
(long-standing fixme: should not have contained the signature itself)
     new 24f6f150 auditor-lib now builds
     new 2956217b fix compiler warning
     new 2024ccd2 complete auditor httpd side of deposit confirmation handling 
(auditordb not yet ready, though)

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 configure.ac                                       |   1 +
 src/Makefile.am                                    |   2 +-
 src/auditor-lib/Makefile.am                        |   5 +-
 src/auditor-lib/auditor_api_deposit_confirmation.c | 220 +++++++++++----------
 src/auditor-lib/auditor_api_handle.c               |  12 +-
 src/{exchange-lib => auditor-lib}/backoff.h        |   8 +-
 src/{exchange-lib => auditor-lib}/curl_defaults.h  |   6 +-
 .../taler-auditor-httpd_deposit-confirmation.c     |  99 +++++++---
 src/exchange-lib/exchange_api_handle.c             |  44 ++---
 src/exchange-tools/taler-exchange-keycheck.c       |   6 +-
 src/exchange-tools/taler-exchange-keyup.c          |   7 +-
 src/exchange/taler-exchange-httpd_keystate.c       |  14 +-
 src/include/taler_auditor_service.h                |  53 +++++
 src/include/taler_auditordb_plugin.h               |  52 +++++
 src/include/taler_exchangedb_lib.h                 |   6 +
 src/include/taler_signatures.h                     |   7 -
 16 files changed, 357 insertions(+), 185 deletions(-)
 copy src/{exchange-lib => auditor-lib}/backoff.h (81%)
 copy src/{exchange-lib => auditor-lib}/curl_defaults.h (86%)

diff --git a/configure.ac b/configure.ac
index 7763378a..02d86ccd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -546,6 +546,7 @@ AC_CONFIG_FILES([Makefile
                  src/Makefile
                  src/auditor/Makefile
                  src/auditordb/Makefile
+                 src/auditor-lib/Makefile
                  src/bank-lib/Makefile
                  src/exchange/Makefile
                  src/exchangedb/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index d2c92554..584f9423 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -22,7 +22,7 @@ pkgcfg_DATA = \
 EXTRA_DIST = \
   taler.conf
 
-SUBDIRS = include util wire json $(PQ_DIR) $(BANK_LIB) wire-plugins exchangedb 
exchange exchange-tools auditordb auditor
+SUBDIRS = include util wire json $(PQ_DIR) $(BANK_LIB) wire-plugins exchangedb 
exchange exchange-tools auditordb auditor auditor-lib
 if HAVE_LIBCURL
  SUBDIRS += exchange-lib benchmark
 else
diff --git a/src/auditor-lib/Makefile.am b/src/auditor-lib/Makefile.am
index 45ae881d..1e7c87a4 100644
--- a/src/auditor-lib/Makefile.am
+++ b/src/auditor-lib/Makefile.am
@@ -1,5 +1,5 @@
 # This Makefile.am is in the public domain
-AM_CPPFLAGS = -I$(top_srcdir)/src/include 
+AM_CPPFLAGS = -I$(top_srcdir)/src/include
 
 if USE_COVERAGE
   AM_CFLAGS = --coverage -O0
@@ -7,7 +7,7 @@ if USE_COVERAGE
 endif
 
 lib_LTLIBRARIES = \
-  libtalerauditor
+  libtalerauditor.la
 
 libtalerauditor_la_LDFLAGS = \
   -version-info 0:0:0 \
@@ -32,4 +32,3 @@ if HAVE_LIBGNURL
 libtalerauditor_la_LIBADD += -lgnurl
 endif
 endif
-
diff --git a/src/auditor-lib/auditor_api_deposit_confirmation.c 
b/src/auditor-lib/auditor_api_deposit_confirmation.c
index 5b094c2a..1ad6ddad 100644
--- a/src/auditor-lib/auditor_api_deposit_confirmation.c
+++ b/src/auditor-lib/auditor_api_deposit_confirmation.c
@@ -77,16 +77,15 @@ struct TALER_AUDITOR_DepositConfirmationHandle
  *
  * @param cls the `struct TALER_AUDITOR_DepositConfirmationHandle`
  * @param response_code HTTP response code, 0 on error
- * @param json parsed JSON result, NULL on error
+ * @param djson parsed JSON result, NULL on error
  */
 static void
 handle_deposit_confirmation_finished (void *cls,
                                      long response_code,
-                                     const json_t *json)
+                                     const void *djson)
 {
+  const json_t *json = djson;
   struct TALER_AUDITOR_DepositConfirmationHandle *dh = cls;
-  struct TALER_AuditorPublicKeyP auditor_pub;
-  struct TALER_AuditorPublicKeyP *ep = NULL;
 
   dh->job = NULL;
   switch (response_code)
@@ -95,8 +94,6 @@ handle_deposit_confirmation_finished (void *cls,
     break;
   case MHD_HTTP_OK:
     break;
-  case MHD_HTTP_NOT_FOUND:
-    break;
   case MHD_HTTP_BAD_REQUEST:
     /* This should never happen, either us or the auditor is buggy
        (or API version conflict); just pass JSON reply to the application */
@@ -134,76 +131,87 @@ handle_deposit_confirmation_finished (void *cls,
 /**
  * Verify signature information about the deposit-confirmation.
  *
- * @param dki public key information
- * @param amount the amount to be deposit-confirmationed
- * @param h_wire hash of the merchant’s account details
+ * @param h_wire hash of merchant wire details
  * @param h_contract_terms hash of the contact of the merchant with the 
customer (further details are never disclosed to the auditor)
+ * @param timestamp timestamp when the contract was finalized, must not be too 
far in the future
+ * @param refund_deadline date until which the merchant can issue a refund to 
the customer via the auditor (can be zero if refunds are not allowed); must not 
be after the @a wire_deadline
+ * @param amount_without_fee the amount confirmed to be wired by the exchange 
to the merchant
  * @param coin_pub coin’s public key
- * @param timestamp timestamp when the deposit-confirmation was finalized
  * @param merchant_pub the public key of the merchant (used to identify the 
merchant for refund requests)
- * @param refund_deadline date until which the merchant can issue a refund to 
the customer via the auditor (can be zero if refunds are not allowed)
- * @param coin_sig the signature made with purpose 
#TALER_SIGNATURE_WALLET_COIN_DEPOSIT_CONFIRMATION made by the customer with the 
coin’s private key.
+ * @param exchange_sig the signature made with purpose 
#TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT
+ * @param exchange_pub the public key of the exchange that matches @a 
exchange_sig
+ * @param master_pub master public key of the exchange
+ * @param ep_start when does @a exchange_pub validity start
+ * @param ep_expire when does @a exchange_pub usage end
+ * @param ep_end when does @a exchange_pub legal validity end
+ * @param master_sig master signature affirming validity of @a exchange_pub
  * @return #GNUNET_OK if signatures are OK, #GNUNET_SYSERR if not
  */
 static int
-verify_signatures (const struct TALER_Amount *amount,
-                   const struct GNUNET_HashCode *h_wire,
+verify_signatures (const struct GNUNET_HashCode *h_wire,
                    const struct GNUNET_HashCode *h_contract_terms,
-                   const struct TALER_CoinSpendPublicKeyP *coin_pub,
                    struct GNUNET_TIME_Absolute timestamp,
-                   const struct TALER_MerchantPublicKeyP *merchant_pub,
                    struct GNUNET_TIME_Absolute refund_deadline,
-                   const struct TALER_CoinSpendSignatureP *coin_sig)
+                   const struct TALER_Amount *amount_without_fee,
+                   const struct TALER_CoinSpendPublicKeyP *coin_pub,
+                   const struct TALER_MerchantPublicKeyP *merchant_pub,
+                   const struct TALER_ExchangePublicKeyP *exchange_pub,
+                   const struct TALER_CoinSpendSignatureP *exchange_sig,
+                   const struct TALER_MasterPublicKeyP *master_pub,
+                   struct GNUNET_TIME_Absolute ep_start,
+                   struct GNUNET_TIME_Absolute ep_expire,
+                   struct GNUNET_TIME_Absolute ep_end,
+                   const struct TALER_MasterSignatureP *master_sig)
 {
-  struct TALER_DepositConfirmationRequestPS dr;
-  struct TALER_CoinPublicInfo coin_info;
+  struct TALER_DepositConfirmationPS dc;
+  struct TALER_ExchangeSigningKeyValidityPS sv;
 
-  dr.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_DEPOSIT_CONFIRMATION);
-  dr.purpose.size = htonl (sizeof (struct TALER_DepositConfirmationRequestPS));
-  dr.h_contract_terms = *h_contract_terms;
-  dr.h_wire = *h_wire;
-  dr.timestamp = GNUNET_TIME_absolute_hton (timestamp);
-  dr.refund_deadline = GNUNET_TIME_absolute_hton (refund_deadline);
-  TALER_amount_hton (&dr.amount_with_fee,
-                     amount);
-  TALER_amount_hton (&dr.deposit_confirmation_fee,
-                     &dki->fee_deposit_confirmation);
-  dr.merchant = *merchant_pub;
-  dr.coin_pub = *coin_pub;
+  dc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT);
+  dc.purpose.size = htonl (sizeof (struct TALER_DepositConfirmationPS));
+  dc.h_contract_terms = *h_contract_terms;
+  dc.h_wire = *h_wire;
+  dc.timestamp = GNUNET_TIME_absolute_hton (timestamp);
+  dc.refund_deadline = GNUNET_TIME_absolute_hton (refund_deadline);
+  TALER_amount_hton (&dc.amount_without_fee,
+                     amount_without_fee);
+  dc.coin_pub = *coin_pub;
+  dc.merchant = *merchant_pub;
   if (GNUNET_OK !=
-      GNUNET_CRYPTO_eddsa_verify 
(TALER_SIGNATURE_WALLET_COIN_DEPOSIT_CONFIRMATION,
-                                  &dr.purpose,
-                                  &coin_sig->eddsa_signature,
-                                  &coin_pub->eddsa_pub))
-  {
+      GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT,
+                                  &dc.purpose,
+                                  &exchange_sig->eddsa_signature,
+                                  &exchange_pub->eddsa_pub))
+    {
     GNUNET_break_op (0);
-    TALER_LOG_WARNING ("Invalid coin signature on /deposit-confirmation 
request!\n");
+    TALER_LOG_WARNING ("Invalid signature on /deposit-confirmation 
request!\n");
     {
-      TALER_LOG_DEBUG ("... amount_with_fee was %s\n",
-                       TALER_amount2s (amount));
-      TALER_LOG_DEBUG ("... deposit-confirmation_fee was %s\n",
-                       TALER_amount2s (&dki->fee_deposit_confirmation));
+      TALER_LOG_DEBUG ("... amount_without_fee was %s\n",
+                       TALER_amount2s (amount_without_fee));
     }
 
     return GNUNET_SYSERR;
   }
-
-  /* check coin signature */
-  coin_info.coin_pub = *coin_pub;
-  coin_info.denom_pub = *denom_pub;
-  coin_info.denom_sig = *denom_sig;
-  if (GNUNET_YES !=
-      TALER_test_coin_valid (&coin_info))
+  sv.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY);
+  sv.purpose.size = htonl (sizeof (struct TALER_ExchangeSigningKeyValidityPS));
+  sv.master_public_key = *master_pub;
+  sv.start = GNUNET_TIME_absolute_hton (ep_start);
+  sv.expire = GNUNET_TIME_absolute_hton (ep_expire);
+  sv.end = GNUNET_TIME_absolute_hton (ep_end);
+  sv.signkey_pub = *exchange_pub;
+  if (GNUNET_OK !=
+      GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY,
+                                  &sv.purpose,
+                                  &master_sig->eddsa_signature,
+                                  &master_pub->eddsa_pub))
   {
-    GNUNET_break_op (0);
-    TALER_LOG_WARNING ("Invalid coin passed for /deposit-confirmation\n");
+    GNUNET_break (0);
+    TALER_LOG_WARNING ("Invalid signature on exchange signing key!\n");
     return GNUNET_SYSERR;
   }
-  if (0 < TALER_amount_cmp (&dki->fee_deposit_confirmation,
-                            amount))
+  if (0 == GNUNET_TIME_absolute_get_remaining (ep_end).rel_value_us)
   {
-    GNUNET_break_op (0);
-    TALER_LOG_WARNING ("DepositConfirmation amount smaller than fee\n");
+    GNUNET_break (0);
+    TALER_LOG_WARNING ("Exchange signing key is no longer valid!\n");
     return GNUNET_SYSERR;
   }
   return GNUNET_OK;
@@ -224,13 +232,20 @@ verify_signatures (const struct TALER_Amount *amount,
  * NOT initiate the transaction with the auditor and instead return NULL.
  *
  * @param auditor the auditor handle; the auditor must be ready to operate
- * @param amount the amount to be deposit-confirmationed
+ * @param h_wire hash of merchant wire details
  * @param h_contract_terms hash of the contact of the merchant with the 
customer (further details are never disclosed to the auditor)
- * @param coin_pub coin’s public key
  * @param timestamp timestamp when the contract was finalized, must not be too 
far in the future
- * @param merchant_pub the public key of the merchant (used to identify the 
merchant for refund requests)
  * @param refund_deadline date until which the merchant can issue a refund to 
the customer via the auditor (can be zero if refunds are not allowed); must not 
be after the @a wire_deadline
- * @param coin_sig the signature made with purpose 
#TALER_SIGNATURE_WALLET_COIN_DEPOSIT-CONFIRMATION made by the customer with the 
coin’s private key.
+ * @param amount_without_fee the amount confirmed to be wired by the exchange 
to the merchant
+ * @param coin_pub coin’s public key
+ * @param merchant_pub the public key of the merchant (used to identify the 
merchant for refund requests)
+ * @param exchange_sig the signature made with purpose 
#TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT
+ * @param exchange_pub the public key of the exchange that matches @a 
exchange_sig
+ * @param master_pub master public key of the exchange
+ * @param ep_start when does @a exchange_pub validity start
+ * @param ep_expire when does @a exchange_pub usage end
+ * @param ep_end when does @a exchange_pub legal validity end
+ * @param master_sig master signature affirming validity of @a exchange_pub
  * @param cb the callback to call when a reply for this request is available
  * @param cb_cls closure for the above callback
  * @return a handle for this request; NULL if the inputs are invalid (i.e.
@@ -238,13 +253,20 @@ verify_signatures (const struct TALER_Amount *amount,
  */
 struct TALER_AUDITOR_DepositConfirmationHandle *
 TALER_AUDITOR_deposit_confirmation (struct TALER_AUDITOR_Handle *auditor,
-                                   const struct GNUNET_HashCode *h_wire,
-                                   const struct TALER_Amount 
*amount_without_fees,
-                                   const struct GNUNET_HashCode 
*h_contract_terms,
-                                   const struct TALER_CoinSpendPublicKeyP 
*coin_pub,
-                                   struct GNUNET_TIME_Absolute timestamp,
-                                   const struct TALER_MerchantPublicKeyP 
*merchant_pub,
-                                   struct GNUNET_TIME_Absolute refund_deadline,
+                                    const struct GNUNET_HashCode *h_wire,
+                                    const struct GNUNET_HashCode 
*h_contract_terms,
+                                    struct GNUNET_TIME_Absolute timestamp,
+                                    struct GNUNET_TIME_Absolute 
refund_deadline,
+                                    const struct TALER_Amount 
*amount_without_fee,
+                                    const struct TALER_CoinSpendPublicKeyP 
*coin_pub,
+                                    const struct TALER_MerchantPublicKeyP 
*merchant_pub,
+                                    const struct TALER_ExchangePublicKeyP 
*exchange_pub,
+                                    const struct TALER_CoinSpendSignatureP 
*exchange_sig,
+                                    const struct TALER_MasterPublicKeyP 
*master_pub,
+                                    struct GNUNET_TIME_Absolute ep_start,
+                                    struct GNUNET_TIME_Absolute ep_expire,
+                                    struct GNUNET_TIME_Absolute ep_end,
+                                    const struct TALER_MasterSignatureP 
*master_sig,
                                    
TALER_AUDITOR_DepositConfirmationResultCallback cb,
                                    void *cb_cls)
 {
@@ -252,45 +274,55 @@ TALER_AUDITOR_deposit_confirmation (struct 
TALER_AUDITOR_Handle *auditor,
   struct GNUNET_CURL_Context *ctx;
   json_t *deposit_confirmation_obj;
   CURL *eh;
-  struct TALER_Amount amount_without_fee;
 
-  (void) GNUNET_TIME_round_abs (&wire_deadline);
+  (void) GNUNET_TIME_round_abs (&timestamp);
   (void) GNUNET_TIME_round_abs (&refund_deadline);
-  GNUNET_assert (refund_deadline.abs_value_us <= wire_deadline.abs_value_us);
+  (void) GNUNET_TIME_round_abs (&ep_start);
+  (void) GNUNET_TIME_round_abs (&ep_expire);
+  (void) GNUNET_TIME_round_abs (&ep_end);
   GNUNET_assert (GNUNET_YES ==
                 MAH_handle_is_ready (auditor));
   if (GNUNET_OK !=
-      verify_signatures (amount,
-                         &h_wire,
+      verify_signatures (h_wire,
                          h_contract_terms,
-                         coin_pub,
                          timestamp,
-                         merchant_pub,
                          refund_deadline,
-                         coin_sig))
+                         amount_without_fee,
+                         coin_pub,
+                         merchant_pub,
+                         exchange_pub,
+                         exchange_sig,
+                         master_pub,
+                         ep_start,
+                         ep_expire,
+                         ep_end,
+                         master_sig))
   {
     GNUNET_break_op (0);
     return NULL;
   }
 
   deposit_confirmation_obj
-    = json_pack ("{s:o, s:o," /* f/wire */
-                " s:o, s:o," /* H_wire, h_contract_terms */
-                " s:o, s:o," /* coin_pub, denom_pub */
-                " s:o, s:o," /* ub_sig, timestamp */
-                " s:o," /* merchant_pub */
-                " s:o, s:o," /* refund_deadline, wire_deadline */
-                " s:o}",     /* coin_sig */
-                "contribution", TALER_JSON_from_amount (amount),
+    = json_pack ("{s:o, s:o," /* H_wire, h_contract_terms */
+                " s:o, s:o," /* timestamp, refund_deadline */
+                " s:o, s:o," /* amount_without_fees, coin_pub */
+                " s:o, s:o," /* merchant_pub, exchange_sig */
+                " s:o, s:o," /* master_pub, ep_start */
+                " s:o, s:o," /* ep_expire, ep_end */
+                 " s:o}",     /* master_sig */
                 "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),
                 "timestamp", GNUNET_JSON_from_time_abs (timestamp),
-                "merchant_pub", GNUNET_JSON_from_data_auto (merchant_pub),
                 "refund_deadline", GNUNET_JSON_from_time_abs (refund_deadline),
-                "wire_transfer_deadline", GNUNET_JSON_from_time_abs 
(wire_deadline),
-                "coin_sig", GNUNET_JSON_from_data_auto (coin_sig)
-                );
+                "amount_without_fee", TALER_JSON_from_amount 
(amount_without_fee),
+                "coin_pub", GNUNET_JSON_from_data_auto (coin_pub),
+                "merchant_pub", GNUNET_JSON_from_data_auto (merchant_pub),
+                "exchange_sig", GNUNET_JSON_from_data_auto (exchange_sig),
+                "master_pub", GNUNET_JSON_from_data_auto (master_pub),
+                "ep_start", GNUNET_JSON_from_time_abs (ep_start),
+                "ep_expire", GNUNET_JSON_from_time_abs (ep_expire),
+                "ep_end", GNUNET_JSON_from_time_abs (ep_end),
+                "master_sig", GNUNET_JSON_from_data_auto (master_sig));
   if (NULL == deposit_confirmation_obj)
   {
     GNUNET_break (0);
@@ -302,20 +334,8 @@ TALER_AUDITOR_deposit_confirmation (struct 
TALER_AUDITOR_Handle *auditor,
   dh->cb = cb;
   dh->cb_cls = cb_cls;
   dh->url = MAH_path_to_url (auditor, "/deposit-confirmation");
-  dh->depconf.purpose.size = htonl (sizeof (struct 
TALER_DepositConfirmationConfirmationPS));
-  dh->depconf.purpose.purpose = htonl 
(TALER_SIGNATURE_EXCHANGE_DEPOSIT_CONFIRMATION);
-  dh->depconf.h_contract_terms = *h_contract_terms;
-  dh->depconf.h_wire = h_wire;
-  dh->depconf.timestamp = GNUNET_TIME_absolute_hton (timestamp);
-  dh->depconf.refund_deadline = GNUNET_TIME_absolute_hton (refund_deadline);
-  TALER_amount_hton (&dh->depconf.amount_without_fee,
-                     &amount_without_fee);
-  dh->depconf.coin_pub = *coin_pub;
-  dh->depconf.merchant = *merchant_pub;
-  dh->amount_with_fee = *amount;
-  dh->coin_value = dki->value;
 
-  eh = TEL_curl_easy_get (dh->url);
+  eh = TAL_curl_easy_get (dh->url);
   GNUNET_assert (NULL != (dh->json_enc =
                           json_dumps (deposit_confirmation_obj,
                                       JSON_COMPACT)));
@@ -335,7 +355,7 @@ TALER_AUDITOR_deposit_confirmation (struct 
TALER_AUDITOR_Handle *auditor,
   dh->job = GNUNET_CURL_job_add (ctx,
                                 eh,
                                 GNUNET_YES,
-                                (GC_JCC) &handle_deposit_confirmation_finished,
+                                &handle_deposit_confirmation_finished,
                                 dh);
   return dh;
 }
diff --git a/src/auditor-lib/auditor_api_handle.c 
b/src/auditor-lib/auditor_api_handle.c
index b3557c26..26eca74e 100644
--- a/src/auditor-lib/auditor_api_handle.c
+++ b/src/auditor-lib/auditor_api_handle.c
@@ -206,13 +206,13 @@ decode_version_json (const json_t *resp_obj,
                      struct TALER_AUDITOR_VersionInformation *vi,
                      enum TALER_AUDITOR_VersionCompatibility *vc)
 {
-  struct TALER_AuditorPublicKeyP pub;
   unsigned int age;
   unsigned int revision;
   unsigned int current;
+  const char *ver;
   struct GNUNET_JSON_Specification spec[] = {
     GNUNET_JSON_spec_string ("version",
-                            &vi->version),
+                            &ver),
     GNUNET_JSON_spec_fixed_auto ("master_public_key",
                                 &vi->auditor_pub),
     GNUNET_JSON_spec_end()
@@ -242,6 +242,7 @@ decode_version_json (const json_t *resp_obj,
     free_version_info (vi);
     return GNUNET_SYSERR;
   }
+  vi->version = GNUNET_strdup (ver);
   *vc = TALER_AUDITOR_VC_MATCH;
   if (TALER_PROTOCOL_CURRENT < current)
   {
@@ -279,8 +280,9 @@ request_version (void *cls);
 static void
 version_completed_cb (void *cls,
                      long response_code,
-                     const json_t *resp_obj)
+                     const void *gresp_obj)
 {
+  const json_t *resp_obj = gresp_obj;
   struct VersionRequest *vr = cls;
   struct TALER_AUDITOR_Handle *auditor = vr->auditor;
   enum TALER_AUDITOR_VersionCompatibility vc;
@@ -475,7 +477,7 @@ request_version (void *cls)
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Requesting version with URL `%s'.\n",
               vr->url);
-  eh = TEL_curl_easy_get (vr->url);
+  eh = TAL_curl_easy_get (vr->url);
   GNUNET_assert (CURLE_OK ==
                  curl_easy_setopt (eh,
                                    CURLOPT_VERBOSE,
@@ -491,7 +493,7 @@ request_version (void *cls)
   vr->job = GNUNET_CURL_job_add (auditor->ctx,
                                  eh,
                                  GNUNET_NO,
-                                 (GC_JCC) &version_completed_cb,
+                                 &version_completed_cb,
                                  vr);
   auditor->vr = vr;
 }
diff --git a/src/exchange-lib/backoff.h b/src/auditor-lib/backoff.h
similarity index 81%
copy from src/exchange-lib/backoff.h
copy to src/auditor-lib/backoff.h
index 2af41e7c..523a6b9e 100644
--- a/src/exchange-lib/backoff.h
+++ b/src/auditor-lib/backoff.h
@@ -16,8 +16,8 @@
 */
 
 /**
- * @file exchange-lib/backoff.h
- * @brief backoff computation for the exchange lib
+ * @file auditor-lib/backoff.h
+ * @brief backoff computation for the auditor lib
  * @author Florian Dold
  */
 
@@ -29,9 +29,9 @@
 #include <gnunet/gnunet_time_lib.h>
 
 /**
- * Random exponential backoff used in the exchange lib.
+ * Random exponential backoff used in the auditor lib.
  */
-#define EXCHANGE_LIB_BACKOFF(r) GNUNET_TIME_randomized_backoff ( \
+#define AUDITOR_LIB_BACKOFF(r) GNUNET_TIME_randomized_backoff ( \
     (r), \
     GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2));
 
diff --git a/src/exchange-lib/curl_defaults.h b/src/auditor-lib/curl_defaults.h
similarity index 86%
copy from src/exchange-lib/curl_defaults.h
copy to src/auditor-lib/curl_defaults.h
index 4ca57423..815472c8 100644
--- a/src/exchange-lib/curl_defaults.h
+++ b/src/auditor-lib/curl_defaults.h
@@ -16,7 +16,7 @@
 */
 
 /**
- * @file exchange-lib/curl_defaults.h
+ * @file auditor-lib/curl_defaults.h
  * @brief curl easy handle defaults
  * @author Florian Dold
  */
@@ -31,11 +31,11 @@
 
 /**
  * Get a curl handle with the right defaults
- * for the exchange lib.  In the future, we might manage a pool of connections 
here.
+ * for the auditor lib.  In the future, we might manage a pool of connections 
here.
  *
  * @param url URL to query
  */
 CURL *
-TEL_curl_easy_get (char *url);
+TAL_curl_easy_get (char *url);
 
 #endif /* _TALER_CURL_DEFAULTS_H */
diff --git a/src/auditor/taler-auditor-httpd_deposit-confirmation.c 
b/src/auditor/taler-auditor-httpd_deposit-confirmation.c
index 88ec9c96..10e9245a 100644
--- a/src/auditor/taler-auditor-httpd_deposit-confirmation.c
+++ b/src/auditor/taler-auditor-httpd_deposit-confirmation.c
@@ -51,6 +51,37 @@ reply_deposit_confirmation_success (struct MHD_Connection 
*connection)
 
 
 /**
+ * Store exchange's signing key information in the database.
+ *
+ * @param cls a `struct TALER_AUDITORDB_ExchangeSigningKey *`
+ * @param connection MHD request context
+ * @param session database session and transaction to use
+ * @param[out] mhd_ret set to MHD status on error
+ * @return transaction status
+ */
+static enum GNUNET_DB_QueryStatus
+store_exchange_signing_key_transaction (void *cls,
+                                        struct MHD_Connection *connection,
+                                        struct TALER_AUDITORDB_Session 
*session,
+                                        int *mhd_ret)
+{
+  const struct TALER_AUDITORDB_ExchangeSigningKey *es = cls;
+  enum GNUNET_DB_QueryStatus qs;
+
+  qs = TAH_plugin->insert_exchange_signkey (TAH_plugin->cls,
+                                            session,
+                                            es);
+  if (GNUNET_DB_STATUS_HARD_ERROR == qs)
+  {
+    TALER_LOG_WARNING ("Failed to store exchange signing key in database\n");
+    *mhd_ret = TAH_RESPONSE_reply_internal_db_error (connection,
+                                                    
TALER_EC_DEPOSIT_CONFIRMATION_STORE_DB_ERROR);
+  }
+  return qs;
+}
+
+
+/**
  * Execute database transaction for /deposit-confirmation.  Runs the
  * transaction logic; IF it returns a non-error code, the transaction
  * logic MUST NOT queue a MHD response.  IF it returns an hard error,
@@ -94,17 +125,48 @@ deposit_confirmation_transaction (void *cls,
  *
  * @param connection the MHD connection to handle
  * @param dc information about the deposit confirmation
+ * @param es information about the exchange's signing key
  * @return MHD result code
  */
 static int
 verify_and_execute_deposit_confirmation (struct MHD_Connection *connection,
-                                         const struct 
TALER_AUDITORDB_DepositConfirmation *dc)
+                                         const struct 
TALER_AUDITORDB_DepositConfirmation *dc,
+                                         const struct 
TALER_AUDITORDB_ExchangeSigningKey *es)
 {
   struct TALER_ExchangeSigningKeyValidityPS skv;
   struct TALER_DepositConfirmationPS dcs;
   int mhd_ret;
 
-  /* check signatures */
+  /* check exchange signing key signature */
+  skv.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY);
+  skv.purpose.size = htonl (sizeof (struct 
TALER_ExchangeSigningKeyValidityPS));
+  skv.master_public_key = es->master_public_key;
+  skv.start = GNUNET_TIME_absolute_hton (es->ep_start);
+  skv.expire = GNUNET_TIME_absolute_hton (es->ep_expire);
+  skv.end = GNUNET_TIME_absolute_hton (es->ep_end);
+  skv.signkey_pub = es->exchange_pub;
+  if (GNUNET_OK !=
+      GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY,
+                                  &skv.purpose,
+                                  &es->master_sig.eddsa_signature,
+                                  &es->master_public_key.eddsa_pub))
+  {
+    TALER_LOG_WARNING ("Invalid signature on exchange signing key\n");
+    return TAH_RESPONSE_reply_signature_invalid (connection,
+                                                
TALER_EC_DEPOSIT_CONFIRMATION_SIGNATURE_INVALID,
+                                                 "master_sig");
+  }
+
+  /* execute transaction */
+  if (GNUNET_OK !=
+      TAH_DB_run_transaction (connection,
+                              "persist exchange signing key",
+                             &mhd_ret,
+                             &store_exchange_signing_key_transaction,
+                             (void *) es))
+    return mhd_ret;
+
+  /* check deposit confirmation signature */
   dcs.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT);
   dcs.purpose.size = htonl (sizeof (struct TALER_DepositConfirmationPS));
   dcs.h_contract_terms = dc->h_contract_terms;
@@ -126,26 +188,6 @@ verify_and_execute_deposit_confirmation (struct 
MHD_Connection *connection,
                                                 
TALER_EC_DEPOSIT_CONFIRMATION_SIGNATURE_INVALID,
                                                  "exchange_sig");
   }
-  /* TODO: we should probably cache these, no need to verify the
-     exchange_sig's every time (wastes CPU) */
-  skv.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY);
-  skv.purpose.size = htonl (sizeof (struct 
TALER_ExchangeSigningKeyValidityPS));
-  skv.master_public_key = dc->master_public_key;
-  skv.start; // FIXME
-  skv.expire; // FIXME
-  skv.end; // FIXME
-  skv.signkey_pub = dc->exchange_pub;
-  if (GNUNET_OK !=
-      GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY,
-                                  &skv.purpose,
-                                  &dc->master_sig.eddsa_signature,
-                                  &dc->master_public_key.eddsa_pub))
-  {
-    TALER_LOG_WARNING ("Invalid signature on /deposit-confirmation request\n");
-    return TAH_RESPONSE_reply_signature_invalid (connection,
-                                                
TALER_EC_DEPOSIT_CONFIRMATION_SIGNATURE_INVALID,
-                                                 "master_sig");
-  }
 
   /* execute transaction */
   if (GNUNET_OK !=
@@ -183,6 +225,7 @@ TAH_DEPOSIT_CONFIRMATION_handler (struct TAH_RequestHandler 
*rh,
   json_t *json;
   int res;
   struct TALER_AUDITORDB_DepositConfirmation dc;
+  struct TALER_AUDITORDB_ExchangeSigningKey es;
   struct GNUNET_JSON_Specification spec[] = {
     GNUNET_JSON_spec_fixed_auto ("h_contract_terms", &dc.h_contract_terms),
     GNUNET_JSON_spec_fixed_auto ("h_wire", &dc.h_wire),
@@ -193,8 +236,11 @@ TAH_DEPOSIT_CONFIRMATION_handler (struct 
TAH_RequestHandler *rh,
     GNUNET_JSON_spec_fixed_auto ("merchant_pub", &dc.merchant),
     GNUNET_JSON_spec_fixed_auto ("exchange_sig",  &dc.exchange_sig),
     GNUNET_JSON_spec_fixed_auto ("exchange_pub",  &dc.exchange_pub),
-    GNUNET_JSON_spec_fixed_auto ("master_sig",  &dc.master_sig),
-    GNUNET_JSON_spec_fixed_auto ("master_public_key",  &dc.master_public_key),
+    GNUNET_JSON_spec_fixed_auto ("master_pub",  &es.master_public_key),
+    GNUNET_JSON_spec_fixed_auto ("ep_start",  &es.ep_start),
+    GNUNET_JSON_spec_fixed_auto ("ep_expire",  &es.ep_expire),
+    GNUNET_JSON_spec_fixed_auto ("ep_end",  &es.ep_end),
+    GNUNET_JSON_spec_fixed_auto ("master_sig",  &es.master_sig),
     GNUNET_JSON_spec_end ()
   };
 
@@ -212,12 +258,15 @@ TAH_DEPOSIT_CONFIRMATION_handler (struct 
TAH_RequestHandler *rh,
                              json,
                              spec);
   json_decref (json);
+  es.exchange_pub = dc.exchange_pub; /* used twice! */
+
   if (GNUNET_SYSERR == res)
     return MHD_NO; /* hard failure */
   if (GNUNET_NO == res)
     return MHD_YES; /* failure */
   res = verify_and_execute_deposit_confirmation (connection,
-                                                 &dc);
+                                                 &dc,
+                                                 &es);
   GNUNET_JSON_parse_free (spec);
   return res;
 }
diff --git a/src/exchange-lib/exchange_api_handle.c 
b/src/exchange-lib/exchange_api_handle.c
index 27ee257d..895d1f1d 100644
--- a/src/exchange-lib/exchange_api_handle.c
+++ b/src/exchange-lib/exchange_api_handle.c
@@ -42,9 +42,9 @@
 #define TALER_PROTOCOL_AGE 0
 
 /**
- * Current version for (local) JSON serialization of persisted 
+ * Current version for (local) JSON serialization of persisted
  * /keys data.
- */ 
+ */
 #define TALER_SERIALIZATION_FORMAT_VERSION 0
 
 
@@ -223,9 +223,10 @@ parse_json_signkey (struct TALER_EXCHANGE_SigningPublicKey 
*sign_key,
                     const struct TALER_MasterPublicKeyP *master_key)
 {
   struct TALER_ExchangeSigningKeyValidityPS sign_key_issue;
+  struct TALER_MasterSignatureP sign_key_issue_sig;
   struct GNUNET_JSON_Specification spec[] = {
     GNUNET_JSON_spec_fixed_auto ("master_sig",
-                                 &sign_key->master_sig),
+                                 &sign_key_issue_sig),
     GNUNET_JSON_spec_fixed_auto ("key",
                                  &sign_key->key),
     GNUNET_JSON_spec_absolute_time ("stamp_start",
@@ -250,10 +251,7 @@ parse_json_signkey (struct TALER_EXCHANGE_SigningPublicKey 
*sign_key,
     return GNUNET_OK;
   sign_key_issue.signkey_pub = sign_key->key;
   sign_key_issue.purpose.purpose = htonl 
(TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY);
-  sign_key_issue.purpose.size =
-    htonl (sizeof (struct TALER_ExchangeSigningKeyValidityPS)
-          - offsetof (struct TALER_ExchangeSigningKeyValidityPS,
-                      purpose));
+  sign_key_issue.purpose.size = htonl (sizeof (struct 
TALER_ExchangeSigningKeyValidityPS));
   sign_key_issue.master_public_key = *master_key;
   sign_key_issue.start = GNUNET_TIME_absolute_hton (sign_key->valid_from);
   sign_key_issue.expire = GNUNET_TIME_absolute_hton (sign_key->valid_until);
@@ -261,7 +259,7 @@ parse_json_signkey (struct TALER_EXCHANGE_SigningPublicKey 
*sign_key,
   if (GNUNET_OK !=
       GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY,
                                  &sign_key_issue.purpose,
-                                 &sign_key->master_sig.eddsa_signature,
+                                 &sign_key_issue_sig.eddsa_signature,
                                  &master_key->eddsa_pub))
   {
     GNUNET_break_op (0);
@@ -477,7 +475,7 @@ parse_json_auditor (struct 
TALER_EXCHANGE_AuditorInformation *auditor,
       TALER_amount_hton (&kv.fee_refund,
                         &dk->fee_refund);
       kv.denom_hash = dk->h_key;
-      
+
       if (GNUNET_OK !=
          GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS,
                                      &kv.purpose,
@@ -527,7 +525,7 @@ decode_keys_json (const json_t *resp_obj,
                                 &sig),
     GNUNET_JSON_spec_fixed_auto ("eddsa_pub",
                                 &pub),
-    /* sig and pub must be first, as we skip those if 
+    /* sig and pub must be first, as we skip those if
        check_sig is false! */
     GNUNET_JSON_spec_fixed_auto ("master_public_key",
                                 &key_data->master_pub),
@@ -591,11 +589,11 @@ decode_keys_json (const json_t *resp_obj,
                             NULL, NULL));
 
   /* parse the master public key and issue date of the response */
-  if (check_sig) 
+  if (check_sig)
     hash_context = GNUNET_CRYPTO_hash_context_start ();
   else
     hash_context = NULL;
-  
+
   /* parse the signing keys */
   {
     json_t *sign_keys_array;
@@ -1157,7 +1155,7 @@ deserialize_data (struct TALER_EXCHANGE_Handle *exchange,
     GNUNET_JSON_spec_end()
   };
   struct TALER_EXCHANGE_Keys key_data;
- 
+
   if (NULL == data)
     return;
   if (GNUNET_OK !=
@@ -1175,7 +1173,7 @@ deserialize_data (struct TALER_EXCHANGE_Handle *exchange,
     {
       GNUNET_break (0);
       return;
-    }    
+    }
   memset (&key_data,
          0,
           sizeof (struct TALER_EXCHANGE_Keys));
@@ -1226,7 +1224,7 @@ TALER_EXCHANGE_serialize_data (struct 
TALER_EXCHANGE_Handle *exchange)
   {
     const struct TALER_EXCHANGE_SigningPublicKey *sk = &kd->sign_keys[i];
     json_t *signkey;
-    
+
     if (now.abs_value_us > sk->valid_until.abs_value_us)
       continue; /* skip keys that have expired */
     signkey = json_pack ("{s:o, s:o, s:o, s:o, s:o}",
@@ -1247,13 +1245,13 @@ TALER_EXCHANGE_serialize_data (struct 
TALER_EXCHANGE_Handle *exchange)
     }
     json_array_append_new (signkeys,
                           signkey);
-  }             
+  }
   denoms = json_array ();
   for (unsigned int i=0;i<kd->num_denom_keys;i++)
   {
     const struct TALER_EXCHANGE_DenomPublicKey *dk = &kd->denom_keys[i];
     json_t *denom;
-    
+
     if (now.abs_value_us > dk->expire_deposit.abs_value_us)
       continue; /* skip keys that have expired */
     denom = json_pack ("{s:o, s:o, s:o, s:o, s:o "
@@ -1290,13 +1288,13 @@ TALER_EXCHANGE_serialize_data (struct 
TALER_EXCHANGE_Handle *exchange)
     }
     json_array_append_new (denoms,
                           denom);
-  }             
+  }
   auditors = json_array ();
   for (unsigned int i=0;i<kd->num_auditors;i++)
   {
     const struct TALER_EXCHANGE_AuditorInformation *ai = &kd->auditors[i];
     json_t *a;
-    json_t *adenoms; 
+    json_t *adenoms;
 
     adenoms = json_array ();
     for (unsigned int j=0;j<ai->num_denom_keys;j++)
@@ -1319,7 +1317,7 @@ TALER_EXCHANGE_serialize_data (struct 
TALER_EXCHANGE_Handle *exchange)
       json_array_append_new (adenoms,
                             k);
     }
-    
+
     a = json_pack ("{s:s, s:o, s:o}",
                   "auditor_pub",
                   GNUNET_JSON_from_data_auto (&ai->auditor_pub),
@@ -1334,11 +1332,11 @@ TALER_EXCHANGE_serialize_data (struct 
TALER_EXCHANGE_Handle *exchange)
     }
     json_array_append_new (auditors,
                           a);
-  }             
+  }
   keys = json_pack ("{s:s, s:o, s:o, s:o, s:o"
                    ",s:o, s:o}",
                    /* 1 */
-                   "version", 
+                   "version",
                    kd->version,
                    "master_public_key",
                    GNUNET_JSON_from_data_auto (&kd->master_pub),
@@ -1414,7 +1412,7 @@ TALER_EXCHANGE_connect (struct GNUNET_CURL_Context *ctx,
     case TALER_EXCHANGE_OPTION_DATA:
     {
       const json_t *data = va_arg (ap, const json_t *);
-      
+
       deserialize_data (exchange,
                        data);
       break;
diff --git a/src/exchange-tools/taler-exchange-keycheck.c 
b/src/exchange-tools/taler-exchange-keycheck.c
index 8018e352..74b73cd0 100644
--- a/src/exchange-tools/taler-exchange-keycheck.c
+++ b/src/exchange-tools/taler-exchange-keycheck.c
@@ -64,9 +64,7 @@ signkeys_iter (void *cls,
               (GNUNET_TIME_absolute_ntoh (ski->issue.start)));
 
   if (ntohl (ski->issue.purpose.size) !=
-      (sizeof (struct TALER_ExchangeSigningKeyValidityPS) -
-       offsetof (struct TALER_ExchangeSigningKeyValidityPS,
-                 purpose)))
+      (sizeof (struct TALER_ExchangeSigningKeyValidityPS)))
   {
     fprintf (stderr,
              "Signing key `%s' has invalid purpose size\n",
@@ -85,7 +83,7 @@ signkeys_iter (void *cls,
   if (GNUNET_OK !=
       GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY,
                                   &ski->issue.purpose,
-                                  &ski->issue.signature.eddsa_signature,
+                                  &ski->master_sig.eddsa_signature,
                                   &ski->issue.master_public_key.eddsa_pub))
   {
     fprintf (stderr,
diff --git a/src/exchange-tools/taler-exchange-keyup.c 
b/src/exchange-tools/taler-exchange-keyup.c
index 22c72d5c..cf774957 100644
--- a/src/exchange-tools/taler-exchange-keyup.c
+++ b/src/exchange-tools/taler-exchange-keyup.c
@@ -472,14 +472,11 @@ create_signkey_issue_priv (struct GNUNET_TIME_Absolute 
start,
   GNUNET_CRYPTO_eddsa_key_get_public (&pi->signkey_priv.eddsa_priv,
                                       &issue->signkey_pub.eddsa_pub);
   issue->purpose.purpose = htonl (TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY);
-  issue->purpose.size = htonl (sizeof (struct 
TALER_ExchangeSigningKeyValidityPS) -
-                               offsetof (struct 
TALER_ExchangeSigningKeyValidityPS,
-                                         purpose));
-
+  issue->purpose.size = htonl (sizeof (struct 
TALER_ExchangeSigningKeyValidityPS));
   GNUNET_assert (GNUNET_OK ==
                  GNUNET_CRYPTO_eddsa_sign (&master_priv.eddsa_priv,
                                            &issue->purpose,
-                                           &issue->signature.eddsa_signature));
+                                           &pi->master_sig.eddsa_signature));
 }
 
 
diff --git a/src/exchange/taler-exchange-httpd_keystate.c 
b/src/exchange/taler-exchange-httpd_keystate.c
index 413b9d1b..e624c938 100644
--- a/src/exchange/taler-exchange-httpd_keystate.c
+++ b/src/exchange/taler-exchange-httpd_keystate.c
@@ -795,10 +795,12 @@ reload_keys_denom_iter (void *cls,
  * Convert the public part of a sign key issue to a JSON object.
  *
  * @param ski the sign key issue
+ * @param ski_sig signature over @a ski
  * @return a JSON object describing the sign key issue (public part)
  */
 static json_t *
-sign_key_issue_to_json (const struct TALER_ExchangeSigningKeyValidityPS *ski)
+sign_key_issue_to_json (const struct TALER_ExchangeSigningKeyValidityPS *ski,
+                        const struct TALER_MasterSignatureP *ski_sig)
 {
   return
     json_pack ("{s:o, s:o, s:o, s:o, s:o}",
@@ -809,7 +811,7 @@ sign_key_issue_to_json (const struct 
TALER_ExchangeSigningKeyValidityPS *ski)
                "stamp_end",
                GNUNET_JSON_from_time_abs (GNUNET_TIME_absolute_ntoh 
(ski->end)),
                "master_sig",
-               GNUNET_JSON_from_data_auto (&ski->signature),
+               GNUNET_JSON_from_data_auto (ski_sig),
                "key",
                GNUNET_JSON_from_data_auto (&ski->signkey_pub));
 }
@@ -823,6 +825,7 @@ sign_key_issue_to_json (const struct 
TALER_ExchangeSigningKeyValidityPS *ski)
  * @param cls closure with the `struct ResponseFactoryContext *`
  * @param filename name of the file the key came from
  * @param ski the sign key issue
+ * @param ski_sig signature over @a ski
  * @return #GNUNET_OK to continue to iterate,
  *  #GNUNET_NO to stop iteration with no error,
  *  #GNUNET_SYSERR to abort iteration with error!
@@ -878,7 +881,8 @@ reload_keys_sign_iter (void *cls,
   }
   GNUNET_assert (0 ==
                  json_array_append_new (rfc->sign_keys_array,
-                                        sign_key_issue_to_json (&ski->issue)));
+                                        sign_key_issue_to_json (&ski->issue,
+                                                                
&ski->master_sig)));
 
   return GNUNET_OK;
 }
@@ -1670,7 +1674,7 @@ TEH_KS_acquire_ (const char *location)
        (internal_key_state->next_reload.abs_value_us <= now.abs_value_us) )
   {
     struct TEH_KS_StateHandle *ks = internal_key_state;
-    
+
     internal_key_state = NULL;
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                "KS released in acquire due to expiration\n");
@@ -1976,7 +1980,7 @@ TEH_KS_free ()
   if (NULL != internal_key_state)
   {
     struct TEH_KS_StateHandle *ks = internal_key_state;
-    
+
     internal_key_state = NULL;
     TEH_KS_release (ks);
   }
diff --git a/src/include/taler_auditor_service.h 
b/src/include/taler_auditor_service.h
index 79b131a0..a494a931 100644
--- a/src/include/taler_auditor_service.h
+++ b/src/include/taler_auditor_service.h
@@ -179,6 +179,59 @@ typedef void
 
 
 /**
+ * Submit a deposit-confirmation permission to the auditor and get the
+ * auditor's response.  Note that while we return the response
+ * verbatim to the caller for further processing, we do already verify
+ * that the response is well-formed.  If the auditor's reply is not
+ * well-formed, we return an HTTP status code of zero to @a cb.
+ *
+ * We also verify that the @a exchange_sig is valid for this 
deposit-confirmation
+ * request, and that the @a master_sig is a valid signature for @a
+ * exchange_pub.  Also, the @a auditor must be ready to operate (i.e.  have
+ * finished processing the /version reply).  If either check fails, we do
+ * NOT initiate the transaction with the auditor and instead return NULL.
+ *
+ * @param auditor the auditor handle; the auditor must be ready to operate
+ * @param h_wire hash of merchant wire details
+ * @param h_contract_terms hash of the contact of the merchant with the 
customer (further details are never disclosed to the auditor)
+ * @param timestamp timestamp when the contract was finalized, must not be too 
far in the future
+ * @param refund_deadline date until which the merchant can issue a refund to 
the customer via the auditor (can be zero if refunds are not allowed); must not 
be after the @a wire_deadline
+ * @param amount_without_fee the amount confirmed to be wired by the exchange 
to the merchant
+ * @param coin_pub coin’s public key
+ * @param merchant_pub the public key of the merchant (used to identify the 
merchant for refund requests)
+ * @param exchange_sig the signature made with purpose 
#TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT
+ * @param exchange_pub the public key of the exchange that matches @a 
exchange_sig
+ * @param master_pub master public key of the exchange
+ * @param ep_start when does @a exchange_pub validity start
+ * @param ep_expire when does @a exchange_pub usage end
+ * @param ep_end when does @a exchange_pub legal validity end
+ * @param master_sig master signature affirming validity of @a exchange_pub
+ * @param cb the callback to call when a reply for this request is available
+ * @param cb_cls closure for the above callback
+ * @return a handle for this request; NULL if the inputs are invalid (i.e.
+ *         signatures fail to verify).  In this case, the callback is not 
called.
+ */
+struct TALER_AUDITOR_DepositConfirmationHandle *
+TALER_AUDITOR_deposit_confirmation (struct TALER_AUDITOR_Handle *auditor,
+                                    const struct GNUNET_HashCode *h_wire,
+                                    const struct GNUNET_HashCode 
*h_contract_terms,
+                                    struct GNUNET_TIME_Absolute timestamp,
+                                    struct GNUNET_TIME_Absolute 
refund_deadline,
+                                    const struct TALER_Amount 
*amount_without_fee,
+                                    const struct TALER_CoinSpendPublicKeyP 
*coin_pub,
+                                    const struct TALER_MerchantPublicKeyP 
*merchant_pub,
+                                    const struct TALER_ExchangePublicKeyP 
*exchange_pub,
+                                    const struct TALER_CoinSpendSignatureP 
*exchange_sig,
+                                    const struct TALER_MasterPublicKeyP 
*master_pub,
+                                    struct GNUNET_TIME_Absolute ep_start,
+                                    struct GNUNET_TIME_Absolute ep_expire,
+                                    struct GNUNET_TIME_Absolute ep_end,
+                                    const struct TALER_MasterSignatureP 
*master_sig,
+                                   
TALER_AUDITOR_DepositConfirmationResultCallback cb,
+                                   void *cb_cls);
+
+
+/**
  * Cancel a deposit-confirmation permission request.  This function cannot be 
used
  * on a request handle if a response is already served for it.
  *
diff --git a/src/include/taler_auditordb_plugin.h 
b/src/include/taler_auditordb_plugin.h
index 752ff6a8..fb393052 100644
--- a/src/include/taler_auditordb_plugin.h
+++ b/src/include/taler_auditordb_plugin.h
@@ -187,6 +187,43 @@ struct TALER_AUDITORDB_ProgressPoint
 
 
 /**
+ * Information about a signing key of an exchange.
+ */
+struct TALER_AUDITORDB_ExchangeSigningKey
+{
+  /**
+   * Public master key of the exchange that certified @e master_sig.
+   */
+  struct TALER_MasterPublicKeyP master_public_key;
+
+  /**
+   * When does @e exchange_pub start to be used?
+   */
+  struct GNUNET_TIME_Absolute ep_start;
+
+  /**
+   * When will the exchange stop signing with @e exchange_pub?
+   */
+  struct GNUNET_TIME_Absolute ep_expire;
+
+  /**
+   * When does the signing key expire (for legal disputes)?
+   */
+  struct GNUNET_TIME_Absolute ep_end;
+
+  /**
+   * What is the public offline signing key this is all about?
+   */
+  struct TALER_ExchangePublicKeyP exchange_pub;
+
+  /**
+   * Signature by the offline master key affirming the above.
+   */
+  struct TALER_MasterSignatureP master_sig;
+};
+
+
+/**
  * Information about a deposit confirmation we received from
  * a merchant.
  */
@@ -367,6 +404,21 @@ struct TALER_AUDITORDB_Plugin
 
 
   /**
+   * Insert information about a signing key of the exchange.
+   *
+   * @param cls the @e cls of this struct with the plugin-specific state
+   * @param session connection to the database
+   * @param sk signing key information to store
+   * @return query result status
+   */
+  enum GNUNET_DB_QueryStatus
+  (*insert_exchange_signkey) (void *cls,
+                              struct TALER_AUDITORDB_Session *session,
+                              const struct TALER_AUDITORDB_ExchangeSigningKey 
*sk);
+  // FIXME: above function is not yet implemented!
+
+
+  /**
    * Insert information about a deposit confirmation into the database.
    *
    * @param cls the @e cls of this struct with the plugin-specific state
diff --git a/src/include/taler_exchangedb_lib.h 
b/src/include/taler_exchangedb_lib.h
index b89dd087..f942c5fb 100644
--- a/src/include/taler_exchangedb_lib.h
+++ b/src/include/taler_exchangedb_lib.h
@@ -56,9 +56,15 @@ struct TALER_EXCHANGEDB_PrivateSigningKeyInformationP
   struct TALER_ExchangePrivateKeyP signkey_priv;
 
   /**
+   * Signature over @e issue
+   */
+  struct TALER_MasterSignatureP master_sig;
+
+  /**
    * Public information about a exchange signing key.
    */
   struct TALER_ExchangeSigningKeyValidityPS issue;
+
 };
 
 
diff --git a/src/include/taler_signatures.h b/src/include/taler_signatures.h
index 428fa96e..512198fe 100644
--- a/src/include/taler_signatures.h
+++ b/src/include/taler_signatures.h
@@ -607,13 +607,6 @@ struct TALER_RefreshMeltConfirmationPS
  */
 struct TALER_ExchangeSigningKeyValidityPS
 {
-  /**
-   * Signature over the signing key (by the master key of the exchange).
-   *
-   * FIXME: should be moved outside of the "PS" struct, this is ugly.
-   * (and makes this struct different from all of the others)
-   */
-  struct TALER_MasterSignatureP signature;
 
   /**
    * Purpose is #TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY.

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]