From cbc42d229bdd1b33fee821d0877daf74c098f9c4 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 23 Jun 2024 11:26:22 +0200 Subject: handle POST aml /decision --- src/util/aml_signatures.c | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) (limited to 'src/util/aml_signatures.c') diff --git a/src/util/aml_signatures.c b/src/util/aml_signatures.c index f57fac7bf..49859ef79 100644 --- a/src/util/aml_signatures.c +++ b/src/util/aml_signatures.c @@ -51,11 +51,20 @@ struct TALER_AmlDecisionPS */ struct GNUNET_HashCode h_justification GNUNET_PACKED; + /** + * Hash over the justification text. + */ + struct GNUNET_HashCode h_properties GNUNET_PACKED; + /** * Hash over JSON object with new KYC rules. */ struct GNUNET_HashCode h_new_rules; + /** + * 0: no investigation, 1: yes investigation. + */ + uint64_t flags; }; GNUNET_NETWORK_STRUCT_END @@ -66,6 +75,8 @@ TALER_officer_aml_decision_sign ( struct GNUNET_TIME_Timestamp decision_time, const struct TALER_PaytoHashP *h_payto, const json_t *new_rules, + const json_t *properties, + bool to_investigate, const struct TALER_AmlOfficerPrivateKeyP *officer_priv, struct TALER_AmlOfficerSignatureP *officer_sig) { @@ -73,15 +84,18 @@ TALER_officer_aml_decision_sign ( .purpose.purpose = htonl (TALER_SIGNATURE_AML_DECISION), .purpose.size = htonl (sizeof (ad)), .decision_time = GNUNET_TIME_timestamp_hton (decision_time), - .h_payto = *h_payto + .h_payto = *h_payto, + .flags = GNUNET_htonll (to_investigate ? 1 : 0) }; GNUNET_CRYPTO_hash (justification, strlen (justification), &ad.h_justification); - if (NULL != new_rules) - TALER_json_hash (new_rules, - &ad.h_new_rules); + if (NULL != properties) + TALER_json_hash (properties, + &ad.h_properties); + TALER_json_hash (new_rules, + &ad.h_new_rules); GNUNET_CRYPTO_eddsa_sign (&officer_priv->eddsa_priv, &ad, &officer_sig->eddsa_signature); @@ -94,6 +108,8 @@ TALER_officer_aml_decision_verify ( struct GNUNET_TIME_Timestamp decision_time, const struct TALER_PaytoHashP *h_payto, const json_t *new_rules, + const json_t *properties, + bool to_investigate, const struct TALER_AmlOfficerPublicKeyP *officer_pub, const struct TALER_AmlOfficerSignatureP *officer_sig) { @@ -101,15 +117,18 @@ TALER_officer_aml_decision_verify ( .purpose.purpose = htonl (TALER_SIGNATURE_AML_DECISION), .purpose.size = htonl (sizeof (ad)), .decision_time = GNUNET_TIME_timestamp_hton (decision_time), - .h_payto = *h_payto + .h_payto = *h_payto, + .flags = GNUNET_htonll (to_investigate ? 1 : 0) }; GNUNET_CRYPTO_hash (justification, strlen (justification), &ad.h_justification); - if (NULL != new_rules) - TALER_json_hash (new_rules, - &ad.h_new_rules); + if (NULL != properties) + TALER_json_hash (properties, + &ad.h_properties); + TALER_json_hash (new_rules, + &ad.h_new_rules); return GNUNET_CRYPTO_eddsa_verify ( TALER_SIGNATURE_AML_DECISION, &ad, -- cgit v1.2.3