gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: add one more p2p signature


From: gnunet
Subject: [taler-exchange] branch master updated: add one more p2p signature
Date: Tue, 22 Mar 2022 12:12:07 +0100

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

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 6505f698 add one more p2p signature
6505f698 is described below

commit 6505f6986939a18814fc5ad7a54d5aaa5e6cbfd4
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Tue Mar 22 12:11:40 2022 +0100

    add one more p2p signature
---
 src/include/taler_crypto_lib.h | 54 +++++++++++++++++++++++++++-
 src/include/taler_signatures.h |  5 +++
 src/util/offline_signatures.c  | 82 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 140 insertions(+), 1 deletion(-)

diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index 521a24ae..809c6a8f 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -195,7 +195,7 @@ struct TALER_TransferPublicKeyP
 
 
 /**
- * @brief Type of transfer public keys used during refresh
+ * @brief Type of transfer private keys used during refresh
  * operations.
  */
 struct TALER_TransferPrivateKeyP
@@ -207,6 +207,32 @@ struct TALER_TransferPrivateKeyP
 };
 
 
+/**
+ * @brief Type of public keys used for contract
+ * encryption.
+ */
+struct TALER_ContractDiffiePublicP
+{
+  /**
+   * Taler uses ECDHE for contract encryption.
+   */
+  struct GNUNET_CRYPTO_EcdhePublicKey ecdhe_pub;
+};
+
+
+/**
+ * @brief Type of private keys used for contract
+ * encryption.
+ */
+struct TALER_ContractDiffiePrivateP
+{
+  /**
+   * Taler uses ECDHE for contract encryption.
+   */
+  struct GNUNET_CRYPTO_EcdhePrivateKey ecdhe_priv;
+};
+
+
 /**
  * @brief Type of online public keys used by the exchange to sign
  * messages.
@@ -3427,6 +3453,32 @@ TALER_exchange_offline_denom_validity_verify (
   const struct TALER_MasterSignatureP *master_sig);
 
 
+// FIXME: document
+void
+TALER_exchange_offline_partner_details_sign (
+  const struct TALER_MasterPublicKeyP *partner_pub,
+  struct GNUNET_TIME_Timestamp start_date,
+  struct GNUNET_TIME_Timestamp end_date,
+  struct GNUNET_TIME_Relative wad_frequency,
+  const struct TALER_Amount *wad_fee,
+  const char *partner_base_url,
+  const struct TALER_MasterPrivateKeyP *master_priv,
+  struct TALER_MasterSignatureP *master_sig);
+
+
+// FIXME: document
+enum GNUNET_GenericReturnValue
+TALER_exchange_offline_partner_details_verify (
+  const struct TALER_MasterPublicKeyP *partner_pub,
+  struct GNUNET_TIME_Timestamp start_date,
+  struct GNUNET_TIME_Timestamp end_date,
+  struct GNUNET_TIME_Relative wad_frequency,
+  const struct TALER_Amount *wad_fee,
+  const char *partner_base_url,
+  const struct TALER_MasterPublicKeyP *master_pub,
+  const struct TALER_MasterSignatureP *master_sig);
+
+
 /**
  * Create security module EdDSA signature.
  *
diff --git a/src/include/taler_signatures.h b/src/include/taler_signatures.h
index c730d241..775947ac 100644
--- a/src/include/taler_signatures.h
+++ b/src/include/taler_signatures.h
@@ -97,6 +97,11 @@
  */
 #define TALER_SIGNATURE_MASTER_EXTENSION 1031
 
+/**
+ * Signature affirming a partner configuration for wads.
+ */
+#define TALER_SIGNATURE_MASTER_PARTNER_DETAILS 1032
+
 /*********************************************/
 /* Exchange online signatures (with signing key) */
 /*********************************************/
diff --git a/src/util/offline_signatures.c b/src/util/offline_signatures.c
index c11e20f4..6c99b296 100644
--- a/src/util/offline_signatures.c
+++ b/src/util/offline_signatures.c
@@ -888,4 +888,86 @@ TALER_exchange_wire_signature_make (
 }
 
 
+/**
+ * Message signed by account to merge a purse into a reserve.
+ */
+struct TALER_PartnerConfigurationPS
+{
+
+  /**
+   * Purpose is #TALER_SIGNATURE_MASTER_PARNTER_DETAILS
+   */
+  struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
+  struct TALER_MasterPublicKeyP partner_pub;
+  struct GNUNET_TIME_TimestampNBO start_date;
+  struct GNUNET_TIME_TimestampNBO end_date;
+  struct GNUNET_TIME_RelativeNBO wad_frequency;
+  struct TALER_AmountNBO wad_fee;
+  struct GNUNET_HashCode h_url;
+};
+
+
+void
+TALER_exchange_offline_partner_details_sign (
+  const struct TALER_MasterPublicKeyP *partner_pub,
+  struct GNUNET_TIME_Timestamp start_date,
+  struct GNUNET_TIME_Timestamp end_date,
+  struct GNUNET_TIME_Relative wad_frequency,
+  const struct TALER_Amount *wad_fee,
+  const char *partner_base_url,
+  const struct TALER_MasterPrivateKeyP *master_priv,
+  struct TALER_MasterSignatureP *master_sig)
+{
+  struct TALER_PartnerConfigurationPS wd = {
+    .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_PARTNER_DETAILS),
+    .purpose.size = htonl (sizeof (wd)),
+    .partner_pub = *partner_pub,
+    .start_date = GNUNET_TIME_timestamp_hton (start_date),
+    .end_date = GNUNET_TIME_timestamp_hton (end_date),
+    .wad_frequency = GNUNET_TIME_relative_hton (wad_frequency),
+  };
+
+  GNUNET_CRYPTO_hash (partner_base_url,
+                      strlen (partner_base_url) + 1,
+                      &wd.h_url);
+  TALER_amount_hton (&wd.wad_fee,
+                     wad_fee);
+  GNUNET_CRYPTO_eddsa_sign (&master_priv->eddsa_priv,
+                            &wd,
+                            &master_sig->eddsa_signature);
+}
+
+
+enum GNUNET_GenericReturnValue
+TALER_exchange_offline_partner_details_verify (
+  const struct TALER_MasterPublicKeyP *partner_pub,
+  struct GNUNET_TIME_Timestamp start_date,
+  struct GNUNET_TIME_Timestamp end_date,
+  struct GNUNET_TIME_Relative wad_frequency,
+  const struct TALER_Amount *wad_fee,
+  const char *partner_base_url,
+  const struct TALER_MasterPublicKeyP *master_pub,
+  const struct TALER_MasterSignatureP *master_sig)
+{
+  struct TALER_PartnerConfigurationPS wd = {
+    .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_PARTNER_DETAILS),
+    .purpose.size = htonl (sizeof (wd)),
+    .partner_pub = *partner_pub,
+    .start_date = GNUNET_TIME_timestamp_hton (start_date),
+    .end_date = GNUNET_TIME_timestamp_hton (end_date),
+    .wad_frequency = GNUNET_TIME_relative_hton (wad_frequency),
+  };
+
+  GNUNET_CRYPTO_hash (partner_base_url,
+                      strlen (partner_base_url) + 1,
+                      &wd.h_url);
+  TALER_amount_hton (&wd.wad_fee,
+                     wad_fee);
+  return GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_PARTNER_DETAILS,
+                                     &wd,
+                                     &master_sig->eddsa_signature,
+                                     &master_pub->eddsa_pub);
+}
+
+
 /* end of offline_signatures.c */

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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