add signing/verifying functions for global fees
This commit is contained in:
parent
4835ddf60b
commit
43f8ab6b48
@ -3270,6 +3270,43 @@ TALER_exchange_offline_wire_fee_verify (
|
|||||||
const struct TALER_MasterSignatureP *master_sig);
|
const struct TALER_MasterSignatureP *master_sig);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
* Create wire account addition signature.
|
||||||
*
|
*
|
||||||
|
@ -56,6 +56,12 @@
|
|||||||
*/
|
*/
|
||||||
#define TALER_SIGNATURE_MASTER_ADD_WIRE 1021
|
#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.
|
* Remove payto URI from the list of our wire methods.
|
||||||
*/
|
*/
|
||||||
@ -1250,6 +1256,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.
|
* @brief Message confirming that a denomination key was revoked.
|
||||||
*/
|
*/
|
||||||
|
@ -472,6 +472,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
|
void
|
||||||
TALER_exchange_offline_extension_config_hash_sign (
|
TALER_exchange_offline_extension_config_hash_sign (
|
||||||
const struct TALER_ExtensionConfigHashP *h_config,
|
const struct TALER_ExtensionConfigHashP *h_config,
|
||||||
|
Loading…
Reference in New Issue
Block a user