donau

Donation authority for GNU Taler (experimental)
Log | Files | Refs | Submodules | README | LICENSE

commit 37af64260f7011e640daa52009510250254812a2
parent b31b93eda7e62079894c9d65758068fe3d6a8c32
Author: Matyja Lukas Adam <lukas.matyja@students.bfh.ch>
Date:   Wed, 20 Mar 2024 00:44:57 +0100

[util] create blind sign function

Diffstat:
Msrc/include/donau_crypto_lib.h | 51++++++++++++++++++++++++++++++++++++++++++++++++++-
Msrc/util/donau_signatures.c | 14++++++++++++++
2 files changed, 64 insertions(+), 1 deletion(-)

diff --git a/src/include/donau_crypto_lib.h b/src/include/donau_crypto_lib.h @@ -202,6 +202,18 @@ struct DONAU_BlindedDonationUnitSignature /** + * @brief Type of (unblinded) donation receipts signatures for Taler. + */ +struct DONAU_DonationUnitSignature +{ + /** + * Denominations use blind signatures. + */ + struct GNUNET_CRYPTO_UnblindedSignature *unblinded_sig; +}; + + +/** * @brief Type of signature used by the donau for non-blind signatures. */ struct DONAU_DonauSignatureP @@ -242,7 +254,7 @@ struct DONAU_BlindedUniqueDonationIdentifier /* * GNUNET primitive type representing a generic blinded message */ - struct GNUNET_CRYPTO_BlindedMessage blinded_message; + struct GNUNET_CRYPTO_BlindedMessage *blinded_message; }; /** @@ -272,6 +284,14 @@ struct DONAU_BudiKeyPairsHashP struct GNUNET_HashCode hash; }; +/** + * Hash of a budikeypair array + */ +struct DONAU_BudiHashP +{ + struct GNUNET_HashCode hash; +}; + /* ********************* charity eddsa signing ************************** */ @@ -364,6 +384,35 @@ void DONAU_blinded_donation_unit_sig_free ( struct DONAU_BlindedDonationUnitSignature *donation_unit_sig); +/** + * Create blinded signature. + * + * @param[out] du_sig where to write the signature + * @param du_priv private key to use for signing + * @param budi the unique identifier already blinded + * @return #GNUNET_OK on success + */ +enum GNUNET_GenericReturnValue +TALER_donation_unit_sign_blinded (struct DONAU_BlindedDonationUnitSignature *du_sig, + const struct DONAU_DonationUnitPrivateKey *du_priv, + const struct DONAU_BlindedUniqueDonationIdentifier *budi); + + +/** + * Verify signature made with a donation unit public key + * over a budi. + * + * @param du_pub public donation unit key + * @param du_sig signature made with the private key + * @param budi_hash hash over the budi + * @return #GNUNET_OK if the signature is valid + */ +enum GNUNET_GenericReturnValue +TALER_donation_unit_pub_verify (const struct DONAU_DonationUnitPublicKey *du_pub, + const struct DONAU_DonationUnitSignature *du_sig, + const struct DONAU_BudiHashP *budi_hash); + + // FIXME: Copied from taler_crypto_lib.h, is anything of this necessary? ///** // * Compute the hash of the given @a donation_unit_pub. diff --git a/src/util/donau_signatures.c b/src/util/donau_signatures.c @@ -111,4 +111,18 @@ DONAU_donation_statement_verify ( } +enum GNUNET_GenericReturnValue +TALER_donation_unit_sign_blinded (struct DONAU_BlindedDonationUnitSignature *du_sig, + const struct DONAU_DonationUnitPrivateKey *du_priv, + const struct DONAU_BlindedUniqueDonationIdentifier *budi) +{ + du_sig->blinded_sig + = GNUNET_CRYPTO_blind_sign (du_priv->bsign_priv_key, + /*for_melt ? "rm" :*/ "rw", + budi->blinded_message); + if (NULL == du_sig->blinded_sig) + return GNUNET_SYSERR; + return GNUNET_OK; +} + /* end of donau_signatures.c */