aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-02-01 17:00:51 +0100
committerChristian Grothoff <christian@grothoff.org>2023-02-01 17:00:51 +0100
commite469e6698e154ec2211c0a966117eff8074664a0 (patch)
tree5884384d20d3e12975010504f3f6230a1248bc7c /src/util
parentf0567567fe829548192ba1be433abf28bbe83213 (diff)
downloadexchange-e469e6698e154ec2211c0a966117eff8074664a0.tar.xz
start work on AML decision query API
Diffstat (limited to 'src/util')
-rw-r--r--src/util/aml_signatures.c62
1 files changed, 60 insertions, 2 deletions
diff --git a/src/util/aml_signatures.c b/src/util/aml_signatures.c
index 7d5d30473..cad2e7488 100644
--- a/src/util/aml_signatures.c
+++ b/src/util/aml_signatures.c
@@ -26,8 +26,7 @@
GNUNET_NETWORK_STRUCT_BEGIN
/**
- * @brief Format used to generate the signature on a request to deposit
- * a coin into the account of a merchant.
+ * @brief Format used to generate the signature on an AML decision.
*/
struct TALER_AmlDecisionPS
{
@@ -124,4 +123,63 @@ TALER_officer_aml_decision_verify (
}
+GNUNET_NETWORK_STRUCT_BEGIN
+
+/**
+ * @brief Format used to generate the signature on any AML query.
+ */
+struct TALER_AmlQueryPS
+{
+ /**
+ * Purpose must be #TALER_SIGNATURE_AML_QUERY.
+ * Used for an EdDSA signature with the `struct TALER_AmlOfficerPublicKeyP`.
+ */
+ struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
+
+};
+
+GNUNET_NETWORK_STRUCT_END
+
+
+void
+TALER_officer_aml_query_sign (
+ const struct TALER_AmlOfficerPrivateKeyP *officer_priv,
+ struct TALER_AmlOfficerSignatureP *officer_sig)
+{
+ struct TALER_AmlQueryPS aq = {
+ .purpose.purpose = htonl (TALER_SIGNATURE_AML_QUERY),
+ .purpose.size = htonl (sizeof (aq))
+ };
+
+ GNUNET_CRYPTO_eddsa_sign (&officer_priv->eddsa_priv,
+ &aq,
+ &officer_sig->eddsa_signature);
+}
+
+
+/**
+ * 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,
+ const struct TALER_AmlOfficerSignatureP *officer_sig)
+{
+ struct TALER_AmlQueryPS aq = {
+ .purpose.purpose = htonl (TALER_SIGNATURE_AML_QUERY),
+ .purpose.size = htonl (sizeof (aq))
+ };
+
+ return GNUNET_CRYPTO_eddsa_verify (
+ TALER_SIGNATURE_AML_QUERY,
+ &aq,
+ &officer_sig->eddsa_signature,
+ &officer_pub->eddsa_pub);
+}
+
+
/* end of aml_signatures.c */