From 8f77bda2e0297185c98694edf0d752cc925bf9a2 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 28 Feb 2022 16:13:24 +0100 Subject: -towards getting auditor tests to pass again with new logic --- src/auditor/report-lib.c | 57 +++++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 27 deletions(-) (limited to 'src/auditor/report-lib.c') diff --git a/src/auditor/report-lib.c b/src/auditor/report-lib.c index 03307aaeb..0888f47ae 100644 --- a/src/auditor/report-lib.c +++ b/src/auditor/report-lib.c @@ -558,7 +558,7 @@ TALER_ARL_init (const struct GNUNET_CONFIGURATION_Handle *c) "BASE_URL"); return GNUNET_SYSERR; } - if (GNUNET_YES == GNUNET_is_zero (&TALER_ARL_master_pub)) + if (GNUNET_is_zero (&TALER_ARL_master_pub)) { /* -m option not given, try configuration */ char *master_public_key_str; @@ -596,32 +596,7 @@ TALER_ARL_init (const struct GNUNET_CONFIGURATION_Handle *c) "Taler auditor running for exchange master public key %s\n", TALER_B2S (&TALER_ARL_master_pub)); - if (GNUNET_YES == GNUNET_is_zero (&TALER_ARL_auditor_pub)) - { - /* try loading private key and deriving public key */ - char *fn; - - if (GNUNET_OK == - GNUNET_CONFIGURATION_get_value_filename (c, - "auditor", - "AUDITOR_PRIV_FILE", - &fn)) - { - struct TALER_AuditorPrivateKeyP auditor_priv; - - if (GNUNET_OK == - GNUNET_CRYPTO_eddsa_key_from_file (fn, - GNUNET_NO, /* do NOT create it! */ - &auditor_priv.eddsa_priv)) - { - GNUNET_CRYPTO_eddsa_key_get_public (&auditor_priv.eddsa_priv, - &TALER_ARL_auditor_pub.eddsa_pub); - } - GNUNET_free (fn); - } - } - - if (GNUNET_YES == GNUNET_is_zero (&TALER_ARL_auditor_pub)) + if (GNUNET_is_zero (&TALER_ARL_auditor_pub)) { /* private key not available, try configuration for public key */ char *auditor_public_key_str; @@ -653,6 +628,34 @@ TALER_ARL_init (const struct GNUNET_CONFIGURATION_Handle *c) GNUNET_free (auditor_public_key_str); } + if (GNUNET_is_zero (&TALER_ARL_auditor_pub)) + { + /* try loading private key and deriving public key */ + char *fn; + + if (GNUNET_OK == + GNUNET_CONFIGURATION_get_value_filename (c, + "auditor", + "AUDITOR_PRIV_FILE", + &fn)) + { + struct TALER_AuditorPrivateKeyP auditor_priv; + + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Loading offline private key from `%s' to get auditor public key\n", + fn); + if (GNUNET_OK == + GNUNET_CRYPTO_eddsa_key_from_file (fn, + GNUNET_NO, /* do NOT create it! */ + &auditor_priv.eddsa_priv)) + { + GNUNET_CRYPTO_eddsa_key_get_public (&auditor_priv.eddsa_priv, + &TALER_ARL_auditor_pub.eddsa_pub); + } + GNUNET_free (fn); + } + } + if (GNUNET_OK != TALER_config_get_currency (TALER_ARL_cfg, &TALER_ARL_currency)) -- cgit v1.2.3