commit b452a20f1260485b22c6899bb03c1fed504669ea
parent 78900b241c9a3a7e3dfa5b01eadb7cde31c33ecf
Author: Christian Grothoff <christian@grothoff.org>
Date: Thu, 16 May 2024 20:23:42 +0200
-bump gana
Diffstat:
4 files changed, 107 insertions(+), 7 deletions(-)
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
@@ -2575,6 +2575,32 @@ TALER_token_issue_sig_unblind (
/* **************** AML officer signatures **************** */
/**
+ * Sign KYC authorization. Simple authentication, doesn't actually sign
+ * anything.
+ *
+ * @param account_priv private key of account owner
+ * @param[out] officer_sig where to write the signature
+ */
+void
+TALER_account_kyc_auth_sign (
+ const union TALER_AccountPrivateKeyP *account_priv,
+ union TALER_AccountSignatureP *account_sig);
+
+
+/**
+ * Verify KYC authorization authorization.
+ *
+ * @param account_pub public key of account owner
+ * @param account_sig signature to verify
+ * @return #GNUNET_OK if the signature is valid
+ */
+enum GNUNET_GenericReturnValue
+TALER_account_kyc_auth_verify (
+ const union TALER_AccountPublicKeyP *account_pub,
+ const union TALER_AccountSignatureP *account_sig);
+
+
+/**
* Sign AML query. Simple authentication, doesn't actually
* sign anything.
*
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
@@ -96,6 +96,7 @@ libtalerutil_la_SOURCES = \
getopt.c \
lang.c \
iban.c \
+ kyc_signatures.c \
merchant_signatures.c \
mhd.c \
offline_signatures.c \
diff --git a/src/util/aml_signatures.c b/src/util/aml_signatures.c
@@ -152,13 +152,6 @@ TALER_officer_aml_query_sign (
}
-/**
- * Verify AML query authorization.
- *
- * @param officer_pub public key of AML officer
- * @param officer_sig signature to verify
- * @return #GNUNET_OK if the signature is valid
- */
enum GNUNET_GenericReturnValue
TALER_officer_aml_query_verify (
const struct TALER_AmlOfficerPublicKeyP *officer_pub,
diff --git a/src/util/kyc_signatures.c b/src/util/kyc_signatures.c
@@ -0,0 +1,80 @@
+/*
+ This file is part of TALER
+ Copyright (C) 2024 Taler Systems SA
+
+ TALER is free software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+*/
+/**
+ * @file kyc_signatures.c
+ * @brief Utility functions for KYC account holders
+ * @author Christian Grothoff
+ */
+#include "platform.h"
+#include "taler_util.h"
+#include "taler_signatures.h"
+
+
+GNUNET_NETWORK_STRUCT_BEGIN
+
+/**
+ * @brief Format used to generate the signature on a
+ * KYC authorization.
+ */
+struct TALER_KycQueryPS
+{
+ /**
+ * Purpose must be #TALER_SIGNATURE_KYC_AUTH.
+ * Used for an EdDSA signature with the `union TALER_AccountPublicKeyP`.
+ */
+ struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
+
+};
+
+GNUNET_NETWORK_STRUCT_END
+
+
+void
+TALER_account_kyc_auth_sign (
+ const union TALER_AccountPrivateKeyP *account_priv,
+ union TALER_AccountSignatureP *account_sig)
+{
+ struct TALER_KycQueryPS aq = {
+ .purpose.purpose = htonl (TALER_SIGNATURE_KYC_AUTH),
+ .purpose.size = htonl (sizeof (aq))
+ };
+
+ GNUNET_CRYPTO_eddsa_sign (
+ &account_priv->reserve_priv.eddsa_priv,
+ &aq,
+ &account_sig->reserve_sig.eddsa_signature);
+}
+
+
+enum GNUNET_GenericReturnValue
+TALER_account_kyc_auth_verify (
+ const union TALER_AccountPublicKeyP *account_pub,
+ const union TALER_AccountSignatureP *account_sig)
+{
+ struct TALER_KycQueryPS aq = {
+ .purpose.purpose = htonl (TALER_SIGNATURE_KYC_AUTH),
+ .purpose.size = htonl (sizeof (aq))
+ };
+
+ return GNUNET_CRYPTO_eddsa_verify (
+ TALER_SIGNATURE_KYC_AUTH,
+ &aq,
+ &account_sig->reserve_sig.eddsa_signature,
+ &account_pub->reserve_pub.eddsa_pub);
+}
+
+
+/* end of kyc_signatures.c */