gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-donau] branch master updated: work on issue receipts


From: gnunet
Subject: [taler-donau] branch master updated: work on issue receipts
Date: Wed, 10 Apr 2024 13:36:58 +0200

This is an automated email from the git hooks/post-receive script.

lukas-matyja pushed a commit to branch master
in repository donau.

The following commit(s) were added to refs/heads/master by this push:
     new 1a5385a  work on issue receipts
     new 4298e37  Merge remote-tracking branch 'refs/remotes/origin/master'
1a5385a is described below

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

    work on issue receipts
---
 src/donau/donau-httpd_keys.c             | 16 ++++++++++++-
 src/donau/donau-httpd_keys.h             |  8 +++++++
 src/donau/donau-httpd_post-batch-issue.c | 40 ++++++++++++++++++--------------
 src/testing/test_donau_api.c             | 10 ++++----
 src/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
index 7807817..4e047d3 100644
--- 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
index 3423fc4..5849c30 100644
--- 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
index e497799..dc383c7 100644
--- 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
index 7be0154..e42041c 100644
--- 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
index 1924501..f9f5df8 100644
--- 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

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]