summaryrefslogtreecommitdiff
path: root/src/util/offline_signatures.c
diff options
context:
space:
mode:
authorChristian Grothoff <grothoff@gnunet.org>2022-03-22 12:11:40 +0100
committerChristian Grothoff <grothoff@gnunet.org>2022-03-22 12:12:00 +0100
commit6505f6986939a18814fc5ad7a54d5aaa5e6cbfd4 (patch)
tree37efae7689ae1f1488d50a37b54f00ae13248ddd /src/util/offline_signatures.c
parent6868b78692d0bd4511862872cb078fd4760770d1 (diff)
downloadexchange-6505f6986939a18814fc5ad7a54d5aaa5e6cbfd4.tar.gz
exchange-6505f6986939a18814fc5ad7a54d5aaa5e6cbfd4.tar.bz2
exchange-6505f6986939a18814fc5ad7a54d5aaa5e6cbfd4.zip
add one more p2p signature
Diffstat (limited to 'src/util/offline_signatures.c')
-rw-r--r--src/util/offline_signatures.c82
1 files changed, 82 insertions, 0 deletions
diff --git a/src/util/offline_signatures.c b/src/util/offline_signatures.c
index c11e20f46..6c99b2963 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 */