diff options
author | Thien-Thi Nguyen <ttn@gnuvola.org> | 2022-04-21 06:16:33 -0400 |
---|---|---|
committer | Thien-Thi Nguyen <ttn@gnuvola.org> | 2022-04-22 20:29:45 -0400 |
commit | a72337a5f39b4e826055974fbc5a3261759ebbec (patch) | |
tree | e5baa6f43098d50cd2508ad719df5a5cb9db818d /src/include/taler_crypto_lib.h | |
parent | e40a16aa8ea1b5f7257b0bf04d7413c2ad77d3d3 (diff) | |
download | exchange-a72337a5f39b4e826055974fbc5a3261759ebbec.tar.xz |
Add abstractions: TALER_exchange_deposit_{sign,verify}
This change also removes ‘struct TALER_DepositTrackPS’
from the public API.
* src/include/taler_signatures.h (struct TALER_DepositTrackPS): Delete.
* src/util/exchange_signatures.c (struct TALER_DepositTrackPS): New.
(TALER_exchange_deposit_sign): New func.
(TALER_exchange_deposit_verify): New func.
* src/include/taler_crypto_lib.h
(TALER_exchange_deposit_sign): New func decl.
(TALER_exchange_deposit_verify): New func decl.
* src/exchange/taler-exchange-httpd_deposits_get.c
(TEH_handler_deposits_get): Rework to use ‘TALER_exchange_deposit_verify’.
* src/lib/exchange_api_deposits_get.c
(TALER_EXCHANGE_deposits_get): Rework to use ‘taler_exchange_deposit_sign’.
Diffstat (limited to 'src/include/taler_crypto_lib.h')
-rw-r--r-- | src/include/taler_crypto_lib.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h index 1e4a278c1..2cf4c8f4b 100644 --- a/src/include/taler_crypto_lib.h +++ b/src/include/taler_crypto_lib.h @@ -3370,6 +3370,46 @@ TALER_merchant_refund_verify ( const struct TALER_MerchantSignatureP *merchant_sig); +/* ********************* exchange deposit signing ************************* */ + +/** + * Sign a deposit. + * + * @param h_contract_terms hash of contract terms + * @param h_wire hash of the merchant account details + * @param coin_pub coin to be deposited + * @param merchant_pub merchant public key + * @param merchant_priv private key to sign with + * @param[out] merchant_sig where to write the signature + */ +void +TALER_exchange_deposit_sign ( + const struct TALER_PrivateContractHashP *h_contract_terms, + const struct TALER_MerchantWireHashP *h_wire, + const struct TALER_CoinSpendPublicKeyP *coin_pub, + const struct TALER_MerchantPublicKeyP *merchant_pub, + const struct TALER_MerchantPrivateKeyP *merchant_priv, + struct TALER_MerchantSignatureP *merchant_sig); + +/** + * Verify a deposit. + * + * @param merchant merchant public key + * @param public key of the deposited coin + * @param h_contract_terms hash of contract terms + * @param h_wire hash of the merchant account details + * @param merchant_sig signature of the merchant + * @return #GNUNET_OK if the signature is valid + */ +enum GNUNET_GenericReturnValue +TALER_exchange_deposit_verify ( + const struct TALER_MerchantPublicKeyP *merchant, + const struct TALER_CoinSpendPublicKeyP *coin_pub, + const struct TALER_PrivateContractHashP *h_contract_terms, + const struct TALER_MerchantWireHashP *h_wire, + const struct TALER_MerchantSignatureP *merchant_sig); + + /* ********************* exchange online signing ************************** */ |