exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit 69b2c8b8580ca8ad0b1a3c5aade7f3fcd3e8952f
parent 9d8f7012dad8e52e91749c7b2e8be0286848a0d0
Author: Christian Grothoff <christian@grothoff.org>
Date:   Thu,  5 Feb 2026 17:55:43 +0100

define new unclaim signatures

Diffstat:
Msrc/include/taler/taler_crypto_lib.h | 28++++++++++++++++++++++++++++
Msrc/include/taler/taler_signatures.h | 6++++++
Msrc/util/Makefile.am | 2+-
Msrc/util/wallet_signatures.c | 61+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 96 insertions(+), 1 deletion(-)

diff --git a/src/include/taler/taler_crypto_lib.h b/src/include/taler/taler_crypto_lib.h @@ -4958,6 +4958,34 @@ TALER_wallet_token_use_verify ( const struct TALER_TokenUseSignatureP *token_sig); +/** + * Create order unclaim request signature. + * + * @param h_contract hash of the contact to unclaim + * @param nonce_priv private key of the claim nonce + * @param[out] nsig set to the signature made with purpose #TALER_SIGNATURE_WALLET_ORDER_UNCLAIM + */ +void +TALER_wallet_order_unclaim_sign ( + const struct GNUNET_HashCode *h_contract, + const struct GNUNET_CRYPTO_EddsaPrivateKey *nonce_priv, + struct GNUNET_CRYPTO_EddsaSignature *nsig); + + +/** + * Verify order unclaim signature. + * + * @param h_contract hash of the contact to be unclaimed + * @param nonce nonce from the contract + * @param nsig signature made with purpose #TALER_SIGNATURE_WALLET_ORDER_UNCLAIM + */ +enum GNUNET_GenericReturnValue +TALER_wallet_order_unclaim_verify ( + const struct GNUNET_HashCode *h_contract, + const struct GNUNET_CRYPTO_EddsaPublicKey *nonce, + const struct GNUNET_CRYPTO_EddsaSignature *nsig); + + /* ********************* merchant signing ************************** */ diff --git a/src/include/taler/taler_signatures.h b/src/include/taler/taler_signatures.h @@ -407,6 +407,12 @@ /** + * Signature used to unclaim an order, allowing other wallets to claim it. Signed with the private key of the claim nonce. + */ +#define TALER_SIGNATURE_WALLET_ORDER_UNCLAIM 1223 + + +/** * Signature on a denomination key announcement. */ #define TALER_SIGNATURE_SM_RSA_DENOMINATION_KEY 1250 diff --git a/src/util/Makefile.am b/src/util/Makefile.am @@ -126,7 +126,7 @@ libtalerutil_la_LIBADD = \ -lm libtalerutil_la_LDFLAGS = \ - -version-info 10:0:0 \ + -version-info 11:0:1 \ -no-undefined diff --git a/src/util/wallet_signatures.c b/src/util/wallet_signatures.c @@ -2113,4 +2113,65 @@ TALER_wallet_token_use_verify ( } +GNUNET_NETWORK_STRUCT_BEGIN + +/** + * Message signed by reserve key. + */ +struct TALER_OrderUnclaimPS +{ + + /** + * Purpose is #TALER_SIGNATURE_WALLET_ORDER_UNCLAIM + */ + struct GNUNET_CRYPTO_SignaturePurpose purpose; + + /** + * Hash of the contract being unclaimed. + */ + struct GNUNET_HashCode h_contract; + +}; + +GNUNET_NETWORK_STRUCT_END + + +void +TALER_wallet_order_unclaim_sign ( + const struct GNUNET_HashCode *h_contract, + const struct GNUNET_CRYPTO_EddsaPrivateKey *nonce_priv, + struct GNUNET_CRYPTO_EddsaSignature *nsig) +{ + struct TALER_OrderUnclaimPS rcp = { + .purpose.size = htonl (sizeof (rcp)), + .purpose.purpose = htonl (TALER_SIGNATURE_WALLET_ORDER_UNCLAIM), + .h_contract = *h_contract + }; + + GNUNET_assert (GNUNET_OK == + GNUNET_CRYPTO_eddsa_sign_ (nonce_priv, + &rcp.purpose, + nsig)); +} + + +enum GNUNET_GenericReturnValue +TALER_wallet_order_unclaim_verify ( + const struct GNUNET_HashCode *h_contract, + const struct GNUNET_CRYPTO_EddsaPublicKey *nonce, + const struct GNUNET_CRYPTO_EddsaSignature *nsig) +{ + struct TALER_OrderUnclaimPS rcp = { + .purpose.size = htonl (sizeof (rcp)), + .purpose.purpose = htonl (TALER_SIGNATURE_WALLET_RESERVE_CLOSE), + .h_contract = *h_contract + }; + + return GNUNET_CRYPTO_eddsa_verify_ (TALER_SIGNATURE_WALLET_ORDER_UNCLAIM, + &rcp.purpose, + nsig, + nonce); +} + + /* end of wallet_signatures.c */