commit 7cbdb7ce527af6e62a068d0354f09edd1c486f9f
parent cab09764af1b6ac7a310e48200e70435e4c3fbd6
Author: Christian Grothoff <christian@grothoff.org>
Date: Thu, 13 Aug 2026 19:13:27 +0200
fix aml decision signing
Diffstat:
5 files changed, 103 insertions(+), 23 deletions(-)
diff --git a/src/auditor/taler-helper-auditor-aml.c b/src/auditor/taler-helper-auditor-aml.c
@@ -570,10 +570,10 @@ check_decision_cb (void *cls,
jproperties,
new_measure_name,
to_investigate,
- decider_pub,
- decider_sig,
attributes_expiration,
- h_attributes))
+ h_attributes,
+ decider_pub,
+ decider_sig))
{
if (! report_row ("aml_history",
rowid,
diff --git a/src/exchange/taler-exchange-httpd_post-aml-OFFICER_PUB-decision.c b/src/exchange/taler-exchange-httpd_post-aml-OFFICER_PUB-decision.c
@@ -315,10 +315,10 @@ TEH_handler_post_aml_decision (
properties,
new_measures,
to_investigate,
- officer_pub,
- &officer_sig,
attributes_expiration,
- attributes))
+ attributes,
+ officer_pub,
+ &officer_sig))
{
GNUNET_break_op (0);
ret = TALER_MHD_reply_with_error (
diff --git a/src/include/taler/taler_crypto_lib.h b/src/include/taler/taler_crypto_lib.h
@@ -3552,6 +3552,9 @@ TALER_officer_aml_query_verify (
* @param properties properties of the account, can be NULL
* @param new_measures new measures to apply immediately, NULL for none
* @param to_investigate true if the account should be investigated by AML staff
+ * @param attributes_expiration expiration time of attributes,
+ * #GNUNET_TIME_UNIT_ZERO_ABS if no attributes given
+ * @param attributes attributes set by the AMLO, may be NULL
* @param officer_priv private key of AML officer
* @param[out] officer_sig where to write the signature
*/
@@ -3564,6 +3567,8 @@ TALER_officer_aml_decision_sign (
const json_t *properties,
const char *new_measures,
bool to_investigate,
+ struct GNUNET_TIME_Timestamp attributes_expiration,
+ const json_t *attributes,
const struct TALER_AmlOfficerPrivateKeyP *officer_priv,
struct TALER_AmlOfficerSignatureP *officer_sig);
@@ -3579,11 +3584,11 @@ TALER_officer_aml_decision_sign (
* @param properties properties of the account, can be NULL
* @param new_measures new measures to apply immediately, NULL for none
* @param to_investigate true if the account should be investigated by AML staff
- * @param officer_pub public key of AML officer
- * @param officer_sig signature to verify
* @param attributes_expiration expiration time of attributes,
* #GNUNET_TIME_UNIT_ZERO_ABS if no attributes given
* @param attributes attributes set by the AMLO, may be NULL
+ * @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
@@ -3595,10 +3600,43 @@ TALER_officer_aml_decision_verify (
const json_t *properties,
const char *new_measures,
bool to_investigate,
+ struct GNUNET_TIME_Timestamp attributes_expiration,
+ const json_t *attributes,
const struct TALER_AmlOfficerPublicKeyP *officer_pub,
- const struct TALER_AmlOfficerSignatureP *officer_sig,
+ const struct TALER_AmlOfficerSignatureP *officer_sig);
+
+
+/**
+ * Sign AML decision.
+ *
+ * @param justification human-readable justification
+ * @param decision_time when was the decision made
+ * @param h_payto payto URI hash of the account the
+ * decision is about
+ * @param new_rules new KYC rules to apply to the account
+ * Must be a "LegitimizationRuleSet".
+ * @param properties properties of the account, can be NULL
+ * @param new_measures new measures to apply immediately, NULL for none
+ * @param to_investigate true if the account should be investigated by AML staff
+ * @param attributes_expiration expiration time of attributes,
+ * #GNUNET_TIME_UNIT_ZERO_ABS if no attributes given
+ * @param h_attributes hash over attributes set by the AMLO, may be NULL
+ * @param officer_priv private key of AML officer
+ * @param[out] officer_sig where to write the signature
+ */
+void
+TALER_officer_aml_decision_sign_hashed (
+ const char *justification,
+ struct GNUNET_TIME_Timestamp decision_time,
+ const struct TALER_NormalizedPaytoHashP *h_payto,
+ const json_t *new_rules,
+ const json_t *properties,
+ const char *new_measures,
+ bool to_investigate,
struct GNUNET_TIME_Timestamp attributes_expiration,
- const json_t *attributes);
+ const struct GNUNET_HashCode *h_attributes,
+ const struct TALER_AmlOfficerPrivateKeyP *officer_priv,
+ struct TALER_AmlOfficerSignatureP *officer_sig);
/**
@@ -3635,10 +3673,10 @@ TALER_officer_aml_decision_verify_hashed (
const json_t *properties,
const char *new_measures,
bool to_investigate,
- const struct TALER_AmlOfficerPublicKeyP *officer_pub,
- const struct TALER_AmlOfficerSignatureP *officer_sig,
struct GNUNET_TIME_Timestamp attributes_expiration,
- const struct GNUNET_HashCode *h_attributes);
+ const struct GNUNET_HashCode *h_attributes,
+ const struct TALER_AmlOfficerPublicKeyP *officer_pub,
+ const struct TALER_AmlOfficerSignatureP *officer_sig);
/* **************** Helper-based RSA operations **************** */
diff --git a/src/lib/exchange_api_post-aml-OFFICER_PUB-decision.c b/src/lib/exchange_api_post-aml-OFFICER_PUB-decision.c
@@ -447,6 +447,8 @@ TALER_EXCHANGE_post_aml_decision_start (
padh->properties,
padh->new_measures,
padh->keep_investigating,
+ padh->attributes_expiration,
+ padh->attributes,
&padh->officer_priv,
&officer_sig);
diff --git a/src/util/aml_signatures.c b/src/util/aml_signatures.c
@@ -85,7 +85,7 @@ struct TALER_AmlDecisionPS
GNUNET_NETWORK_STRUCT_END
void
-TALER_officer_aml_decision_sign (
+TALER_officer_aml_decision_sign_hashed (
const char *justification,
struct GNUNET_TIME_Timestamp decision_time,
const struct TALER_NormalizedPaytoHashP *h_payto,
@@ -93,6 +93,8 @@ TALER_officer_aml_decision_sign (
const json_t *properties,
const char *new_measure,
bool to_investigate,
+ struct GNUNET_TIME_Timestamp attributes_expiration,
+ const struct GNUNET_HashCode *h_attributes,
const struct TALER_AmlOfficerPrivateKeyP *officer_priv,
struct TALER_AmlOfficerSignatureP *officer_sig)
{
@@ -100,6 +102,8 @@ 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),
+ .attributes_expiration_time = GNUNET_TIME_timestamp_hton (
+ attributes_expiration),
.h_payto = *h_payto,
.flags = GNUNET_htonll (to_investigate ? 1 : 0)
};
@@ -116,12 +120,48 @@ TALER_officer_aml_decision_sign (
GNUNET_CRYPTO_hash (new_measure,
strlen (new_measure),
&ad.h_new_measure);
+ if (NULL != h_attributes)
+ ad.h_attributes = *h_attributes;
GNUNET_CRYPTO_eddsa_sign (&officer_priv->eddsa_priv,
&ad,
&officer_sig->eddsa_signature);
}
+void
+TALER_officer_aml_decision_sign (
+ const char *justification,
+ struct GNUNET_TIME_Timestamp decision_time,
+ const struct TALER_NormalizedPaytoHashP *h_payto,
+ const json_t *new_rules,
+ const json_t *properties,
+ const char *new_measure,
+ bool to_investigate,
+ struct GNUNET_TIME_Timestamp attributes_expiration,
+ const json_t *attributes,
+ const struct TALER_AmlOfficerPrivateKeyP *officer_priv,
+ struct TALER_AmlOfficerSignatureP *officer_sig)
+{
+ struct GNUNET_HashCode h_attributes;
+
+ if (NULL != attributes)
+ TALER_json_hash (attributes,
+ &h_attributes);
+ return TALER_officer_aml_decision_sign_hashed (
+ justification,
+ decision_time,
+ h_payto,
+ new_rules,
+ properties,
+ new_measure,
+ to_investigate,
+ attributes_expiration,
+ (NULL != attributes) ? &h_attributes : NULL,
+ officer_priv,
+ officer_sig);
+}
+
+
enum GNUNET_GenericReturnValue
TALER_officer_aml_decision_verify_hashed (
const char *justification,
@@ -131,10 +171,10 @@ TALER_officer_aml_decision_verify_hashed (
const json_t *properties,
const char *new_measures,
bool to_investigate,
- const struct TALER_AmlOfficerPublicKeyP *officer_pub,
- const struct TALER_AmlOfficerSignatureP *officer_sig,
struct GNUNET_TIME_Timestamp attributes_expiration,
- const struct GNUNET_HashCode *h_attributes)
+ const struct GNUNET_HashCode *h_attributes,
+ const struct TALER_AmlOfficerPublicKeyP *officer_pub,
+ const struct TALER_AmlOfficerSignatureP *officer_sig)
{
struct TALER_AmlDecisionPS ad = {
.purpose.purpose = htonl (TALER_SIGNATURE_AML_DECISION),
@@ -177,10 +217,10 @@ TALER_officer_aml_decision_verify (
const json_t *properties,
const char *new_measures,
bool to_investigate,
- const struct TALER_AmlOfficerPublicKeyP *officer_pub,
- const struct TALER_AmlOfficerSignatureP *officer_sig,
struct GNUNET_TIME_Timestamp attributes_expiration,
- const json_t *attributes)
+ const json_t *attributes,
+ const struct TALER_AmlOfficerPublicKeyP *officer_pub,
+ const struct TALER_AmlOfficerSignatureP *officer_sig)
{
struct GNUNET_HashCode h_attributes;
@@ -195,10 +235,10 @@ TALER_officer_aml_decision_verify (
properties,
new_measures,
to_investigate,
- officer_pub,
- officer_sig,
attributes_expiration,
- (NULL != attributes) ? &h_attributes : NULL);
+ (NULL != attributes) ? &h_attributes : NULL,
+ officer_pub,
+ officer_sig);
}