aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/include/taler_crypto_lib.h37
-rw-r--r--src/include/taler_signatures.h36
-rw-r--r--src/util/offline_signatures.c48
3 files changed, 121 insertions, 0 deletions
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index d81f5a71d..1beada699 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -3271,6 +3271,43 @@ TALER_exchange_offline_wire_fee_verify (
/**
+ * Create global fees signature.
+ *
+ * @param start_time when do the fees start to apply
+ * @param end_time when do the fees start to apply
+ * @param fees the global fees
+ * @param master_priv private key to sign with
+ * @param[out] master_sig where to write the signature
+ */
+void
+TALER_exchange_offline_global_fee_sign (
+ struct GNUNET_TIME_Timestamp start_time,
+ struct GNUNET_TIME_Timestamp end_time,
+ const struct TALER_GlobalFeeSet *fees,
+ const struct TALER_MasterPrivateKeyP *master_priv,
+ struct TALER_MasterSignatureP *master_sig);
+
+
+/**
+ * Verify global fees signature.
+ *
+ * @param start_time when do the fees start to apply
+ * @param end_time when do the fees start to apply
+ * @param fees the global fees
+ * @param master_pub public key to verify against
+ * @param master_sig the signature the signature
+ * @return #GNUNET_OK if the signature is valid
+ */
+enum GNUNET_GenericReturnValue
+TALER_exchange_offline_global_fee_verify (
+ struct GNUNET_TIME_Timestamp start_time,
+ struct GNUNET_TIME_Timestamp end_time,
+ const struct TALER_GlobalFeeSet *fees,
+ const struct TALER_MasterPublicKeyP *master_pub,
+ const struct TALER_MasterSignatureP *master_sig);
+
+
+/**
* Create wire account addition signature.
*
* @param payto_uri bank account
diff --git a/src/include/taler_signatures.h b/src/include/taler_signatures.h
index 3758792ae..ed985938b 100644
--- a/src/include/taler_signatures.h
+++ b/src/include/taler_signatures.h
@@ -57,6 +57,12 @@
#define TALER_SIGNATURE_MASTER_ADD_WIRE 1021
/**
+ * Signature over global set of fees charged by the
+ * exchange.
+ */
+#define TALER_SIGNATURE_MASTER_GLOBAL_FEES 1022
+
+/**
* Remove payto URI from the list of our wire methods.
*/
#define TALER_SIGNATURE_MASTER_DEL_WIRE 1023
@@ -1251,6 +1257,36 @@ struct TALER_MasterWireFeePS
/**
+ * Global fees charged by the exchange independent of
+ * denomination or wire method.
+ */
+struct TALER_MasterGlobalFeePS
+{
+
+ /**
+ * Purpose is #TALER_SIGNATURE_MASTER_GLOBAL_FEES.
+ */
+ struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
+
+ /**
+ * Start date when the fee goes into effect.
+ */
+ struct GNUNET_TIME_TimestampNBO start_date;
+
+ /**
+ * End date when the fee stops being in effect (exclusive)
+ */
+ struct GNUNET_TIME_TimestampNBO end_date;
+
+ /**
+ * Fee charged to the merchant per wire transfer.
+ */
+ struct TALER_GlobalFeeSetNBOP fees;
+
+};
+
+
+/**
* @brief Message confirming that a denomination key was revoked.
*/
struct TALER_MasterDenominationKeyRevocationPS
diff --git a/src/util/offline_signatures.c b/src/util/offline_signatures.c
index bc1625992..5aef4ac3e 100644
--- a/src/util/offline_signatures.c
+++ b/src/util/offline_signatures.c
@@ -473,6 +473,54 @@ TALER_exchange_offline_wire_fee_verify (
void
+TALER_exchange_offline_global_fee_sign (
+ struct GNUNET_TIME_Timestamp start_time,
+ struct GNUNET_TIME_Timestamp end_time,
+ const struct TALER_GlobalFeeSet *fees,
+ const struct TALER_MasterPrivateKeyP *master_priv,
+ struct TALER_MasterSignatureP *master_sig)
+{
+ struct TALER_MasterGlobalFeePS kv = {
+ .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_GLOBAL_FEES),
+ .purpose.size = htonl (sizeof (kv)),
+ .start_date = GNUNET_TIME_timestamp_hton (start_time),
+ .end_date = GNUNET_TIME_timestamp_hton (end_time),
+ };
+
+ TALER_global_fee_set_hton (&kv.fees,
+ fees);
+ GNUNET_CRYPTO_eddsa_sign (&master_priv->eddsa_priv,
+ &kv,
+ &master_sig->eddsa_signature);
+}
+
+
+enum GNUNET_GenericReturnValue
+TALER_exchange_offline_global_fee_verify (
+ struct GNUNET_TIME_Timestamp start_time,
+ struct GNUNET_TIME_Timestamp end_time,
+ const struct TALER_GlobalFeeSet *fees,
+ const struct TALER_MasterPublicKeyP *master_pub,
+ const struct TALER_MasterSignatureP *master_sig)
+{
+ struct TALER_MasterGlobalFeePS wf = {
+ .purpose.purpose = htonl (TALER_SIGNATURE_MASTER_GLOBAL_FEES),
+ .purpose.size = htonl (sizeof (wf)),
+ .start_date = GNUNET_TIME_timestamp_hton (start_time),
+ .end_date = GNUNET_TIME_timestamp_hton (end_time)
+ };
+
+ TALER_global_fee_set_hton (&wf.fees,
+ fees);
+ return
+ GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_GLOBAL_FEES,
+ &wf,
+ &master_sig->eddsa_signature,
+ &master_pub->eddsa_pub);
+}
+
+
+void
TALER_exchange_offline_extension_config_hash_sign (
const struct TALER_ExtensionConfigHashP *h_config,
const struct TALER_MasterPrivateKeyP *master_priv,