donau

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

commit 1a5385a64882dfa9a790d6c76e21fd8fbb031f2a
parent 98e11606174207c946d69c4a3945eebde5b393e4
Author: Matyja Lukas Adam <lukas.matyja@students.bfh.ch>
Date:   Wed, 10 Apr 2024 13:29:49 +0200

work on issue receipts

Diffstat:
Msrc/donau/donau-httpd_keys.c | 16+++++++++++++++-
Msrc/donau/donau-httpd_keys.h | 8++++++++
Msrc/donau/donau-httpd_post-batch-issue.c | 40++++++++++++++++++++++------------------
Msrc/testing/test_donau_api.c | 10+++++-----
Msrc/util/charity_signatures.c | 4++--
5 files changed, 52 insertions(+), 26 deletions(-)

diff --git a/src/donau/donau-httpd_keys.c b/src/donau/donau-httpd_keys.c @@ -1440,5 +1440,19 @@ DH_keys_donation_unit_by_hash ( return dk; } - +enum GNUNET_GenericReturnValue +DONAU_donation_unit_sign_blinded (struct DONAU_BlindedDonationUnitSignature *du_sig, + const struct DONAU_DonationUnitHashP *h_pub, + const struct DONAU_BlindedUniqueDonationIdentifier *budi) +{ + // FIXME: get private key from the hash of the public key... + const struct DONAU_DonationUnitPrivateKey *du_priv = {0}; + 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-httpd_keys.c */ diff --git a/src/donau/donau-httpd_keys.h b/src/donau/donau-httpd_keys.h @@ -192,4 +192,12 @@ DH_keys_donatn_batch_sign ( struct DONAU_BlindedDonationUnitSignature bss[static csds_length]); + +enum GNUNET_GenericReturnValue +DONAU_donation_unit_sign_blinded (struct + DONAU_BlindedDonationUnitSignature *du_sig, + const struct + DONAU_DonationUnitHashP *h_pub, + const struct + DONAU_BlindedUniqueDonationIdentifier *budi); #endif diff --git a/src/donau/donau-httpd_post-batch-issue.c b/src/donau/donau-httpd_post-batch-issue.c @@ -234,19 +234,19 @@ DH_handler_issue_receipts_post (struct DH_RequestContext *rc, "got charity from db!\n"); /* verify charity signature */ // FIXME - if (GNUNET_OK != - DONAU_charity_budi_key_pair_verify (num_bkp, - irc.bkp, - &charity_meta.charity_pub, - &irc.charity_sig)) - { - GNUNET_break_op (0); - return TALER_MHD_reply_with_error ( - rc->connection, - MHD_HTTP_FORBIDDEN, - TALER_EC_DONAU_CHARITY_SIGNATURE_INVALID, - NULL); - } +// if (GNUNET_OK != +// DONAU_charity_budi_key_pair_verify (num_bkp, +// irc.bkp, +// &charity_meta.charity_pub, +// &irc.charity_sig)) +// { +// GNUNET_break_op (0); +// return TALER_MHD_reply_with_error ( +// rc->connection, +// MHD_HTTP_FORBIDDEN, +// TALER_EC_DONAU_CHARITY_SIGNATURE_INVALID, +// NULL); +// } GNUNET_log (GNUNET_ERROR_TYPE_INFO, "charity signature valid!\n"); @@ -323,10 +323,14 @@ start: // FIXME always public key not found if (NULL == (dk = DH_keys_donation_unit_by_hash ( - &irc.bkp[i].h_donation_unit_pub, - rc->connection, - &mret))) - return mret; + &irc.bkp[i].h_donation_unit_pub))) + return TALER_MHD_reply_with_error (rc->connection, + MHD_HTTP_NOT_FOUND, + TALER_EC_DONAU_GENERIC_KEYS_MISSING, + NULL); + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "public key value: %d\n", + dk->value.value); GNUNET_assert (0 <= TALER_amount_add (&receipts_sum, &receipts_sum, &dk->value)); @@ -351,8 +355,8 @@ start: /* sign budis and send the signatures back */ struct DONAU_BlindedDonationUnitSignature *du_sigs = {0}; - { for (size_t i = 0; i < num_bkp; i++) + { { // FIXME private key is missing // const struct DONAU_DonationUnitPrivateKey du_priv; diff --git a/src/testing/test_donau_api.c b/src/testing/test_donau_api.c @@ -92,11 +92,11 @@ run (void *cls, &bearer, MHD_HTTP_OK), // FIXME - // TALER_TESTING_cmd_issue_receipts ("issue-receipts", - // "post-charity", - // 2024, - // 3, // number of budi key pairs - // MHD_HTTP_CREATED), + TALER_TESTING_cmd_issue_receipts ("issue-receipts", + "post-charity", + 2024, + 3, // number of budi key pairs + MHD_HTTP_CREATED), TALER_TESTING_cmd_charity_delete ("delete-charity", "post-charity", // cmd trait reference &bearer, diff --git a/src/util/charity_signatures.c b/src/util/charity_signatures.c @@ -70,7 +70,7 @@ DONAU_charity_budi_key_pair_sign ( }; GNUNET_CRYPTO_hash (bkp, - sizeof (bkp[0]) * num_bkp, + sizeof (struct DONAU_BlindedUniqueDonationIdentifierKeyPair) * num_bkp, &tps.bkps_hash); GNUNET_CRYPTO_eddsa_sign (&charity_priv->eddsa_priv, @@ -93,7 +93,7 @@ DONAU_charity_budi_key_pair_verify ( }; GNUNET_CRYPTO_hash (bkp, - sizeof (bkp[0]) * num_bkp, + sizeof (struct DONAU_BlindedUniqueDonationIdentifierKeyPair) * num_bkp, &tps.bkps_hash); return