2015-07-06 09:10:36 +02:00
|
|
|
/*
|
|
|
|
This file is part of TALER
|
2016-01-19 14:39:00 +01:00
|
|
|
Copyright (C) 2014, 2015 GNUnet e.V.
|
2015-07-06 09:10:36 +02:00
|
|
|
|
|
|
|
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
|
2016-07-07 17:55:25 +02:00
|
|
|
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
2015-07-06 09:10:36 +02:00
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @file taler-auditor-sign.c
|
2016-03-01 15:35:04 +01:00
|
|
|
* @brief Tool used by the auditor to sign the exchange's master key and the
|
2015-07-06 09:10:36 +02:00
|
|
|
* denomination key(s).
|
|
|
|
* @author Christian Grothoff
|
|
|
|
*/
|
|
|
|
#include <platform.h>
|
2016-03-01 15:35:04 +01:00
|
|
|
#include "taler_exchangedb_lib.h"
|
2017-07-14 17:43:07 +02:00
|
|
|
#include "taler_auditordb_lib.h"
|
2015-07-06 09:10:36 +02:00
|
|
|
|
|
|
|
|
2015-09-16 19:18:48 +02:00
|
|
|
/**
|
|
|
|
* Are we running in verbose mode?
|
|
|
|
*/
|
2017-03-15 12:01:06 +01:00
|
|
|
static unsigned int verbose;
|
2015-09-16 19:18:48 +02:00
|
|
|
|
2015-07-06 09:10:36 +02:00
|
|
|
/**
|
|
|
|
* Filename of the auditor's private key.
|
|
|
|
*/
|
|
|
|
static char *auditor_key_file;
|
|
|
|
|
|
|
|
/**
|
2016-03-01 15:35:04 +01:00
|
|
|
* File with the Exchange's denomination keys to sign, itself
|
|
|
|
* signed by the Exchange's public key.
|
2015-07-06 09:10:36 +02:00
|
|
|
*/
|
2016-03-01 15:35:04 +01:00
|
|
|
static char *exchange_request_file;
|
2015-07-06 09:10:36 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Where should we write the auditor's signature?
|
|
|
|
*/
|
|
|
|
static char *output_file;
|
|
|
|
|
2016-03-21 01:45:53 +01:00
|
|
|
/**
|
|
|
|
* URL of the auditor (informative for the user).
|
|
|
|
*/
|
|
|
|
static char *auditor_url;
|
|
|
|
|
2015-07-06 09:10:36 +02:00
|
|
|
/**
|
2016-03-01 15:35:04 +01:00
|
|
|
* Master public key of the exchange.
|
2015-07-06 09:10:36 +02:00
|
|
|
*/
|
|
|
|
static struct TALER_MasterPublicKeyP master_public_key;
|
|
|
|
|
2016-04-10 17:10:20 +02:00
|
|
|
/**
|
|
|
|
* Our configuration.
|
|
|
|
*/
|
|
|
|
static struct GNUNET_CONFIGURATION_Handle *cfg;
|
|
|
|
|
2017-07-14 17:43:07 +02:00
|
|
|
/**
|
|
|
|
* Handle to access the auditor's database.
|
|
|
|
*/
|
|
|
|
static struct TALER_AUDITORDB_Plugin *adb;
|
|
|
|
|
2015-07-06 09:10:36 +02:00
|
|
|
|
2015-09-16 19:18:48 +02:00
|
|
|
/**
|
|
|
|
* Print denomination key details for diagnostics.
|
|
|
|
*
|
|
|
|
* @param dk denomination key to print
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
print_dk (const struct TALER_DenominationKeyValidityPS *dk)
|
|
|
|
{
|
|
|
|
struct TALER_Amount a;
|
|
|
|
char *s;
|
|
|
|
|
|
|
|
fprintf (stdout,
|
|
|
|
"Denomination key hash: %s\n",
|
|
|
|
GNUNET_h2s_full (&dk->denom_hash));
|
|
|
|
TALER_amount_ntoh (&a,
|
|
|
|
&dk->value);
|
|
|
|
fprintf (stdout,
|
|
|
|
"Value: %s\n",
|
|
|
|
s = TALER_amount_to_string (&a));
|
|
|
|
GNUNET_free (s);
|
|
|
|
TALER_amount_ntoh (&a,
|
|
|
|
&dk->fee_withdraw);
|
|
|
|
fprintf (stdout,
|
|
|
|
"Withdraw fee: %s\n",
|
|
|
|
s = TALER_amount_to_string (&a));
|
|
|
|
GNUNET_free (s);
|
|
|
|
TALER_amount_ntoh (&a,
|
|
|
|
&dk->fee_deposit);
|
|
|
|
fprintf (stdout,
|
|
|
|
"Deposit fee: %s\n",
|
|
|
|
s = TALER_amount_to_string (&a));
|
|
|
|
GNUNET_free (s);
|
|
|
|
TALER_amount_ntoh (&a,
|
|
|
|
&dk->fee_refresh);
|
|
|
|
fprintf (stdout,
|
|
|
|
"Refresh fee: %s\n",
|
|
|
|
s = TALER_amount_to_string (&a));
|
|
|
|
GNUNET_free (s);
|
2016-04-20 01:50:26 +02:00
|
|
|
TALER_amount_ntoh (&a,
|
|
|
|
&dk->fee_refund);
|
|
|
|
fprintf (stdout,
|
|
|
|
"Refund fee: %s\n",
|
|
|
|
s = TALER_amount_to_string (&a));
|
|
|
|
GNUNET_free (s);
|
2015-09-16 19:18:48 +02:00
|
|
|
|
|
|
|
fprintf (stdout,
|
|
|
|
"Validity start time: %s\n",
|
2015-09-19 16:34:27 +02:00
|
|
|
GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (dk->start)));
|
2015-09-16 19:18:48 +02:00
|
|
|
fprintf (stdout,
|
|
|
|
"Withdraw end time: %s\n",
|
2015-09-19 16:34:27 +02:00
|
|
|
GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (dk->expire_withdraw)));
|
2015-09-16 19:18:48 +02:00
|
|
|
fprintf (stdout,
|
|
|
|
"Deposit end time: %s\n",
|
2016-05-02 05:10:40 +02:00
|
|
|
GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (dk->expire_deposit)));
|
2015-09-16 19:18:48 +02:00
|
|
|
fprintf (stdout,
|
|
|
|
"Legal dispute end time: %s\n",
|
2015-09-19 16:34:27 +02:00
|
|
|
GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (dk->expire_legal)));
|
2015-09-16 19:18:48 +02:00
|
|
|
|
|
|
|
fprintf (stdout,
|
|
|
|
"\n");
|
|
|
|
}
|
|
|
|
|
2015-07-06 09:10:36 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The main function of the taler-auditor-sign tool. This tool is used
|
2016-03-01 15:35:04 +01:00
|
|
|
* to sign a exchange's master and denomination keys, affirming that the
|
|
|
|
* auditor is aware of them and will validate the exchange's database with
|
2015-07-06 09:10:36 +02:00
|
|
|
* respect to these keys.
|
|
|
|
*
|
|
|
|
* @param argc number of arguments from the command line
|
|
|
|
* @param argv command line arguments
|
|
|
|
* @return 0 ok, 1 on error
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
main (int argc,
|
|
|
|
char *const *argv)
|
|
|
|
{
|
2016-04-10 17:10:20 +02:00
|
|
|
char *cfgfile = NULL;
|
|
|
|
const struct GNUNET_GETOPT_CommandLineOption options[] = {
|
2017-03-25 21:22:22 +01:00
|
|
|
GNUNET_GETOPT_option_filename ('a',
|
2017-03-15 12:01:06 +01:00
|
|
|
"auditor-key",
|
|
|
|
"FILENAME",
|
|
|
|
"file containing the private key of the auditor",
|
|
|
|
&auditor_key_file),
|
2017-03-25 21:22:22 +01:00
|
|
|
GNUNET_GETOPT_option_cfgfile (&cfgfile),
|
|
|
|
GNUNET_GETOPT_option_help ("Private key of the auditor to use for signing"),
|
|
|
|
GNUNET_GETOPT_option_mandatory
|
|
|
|
(GNUNET_GETOPT_option_base32_auto ('m',
|
2017-03-15 12:01:06 +01:00
|
|
|
"exchange-key",
|
|
|
|
"KEY",
|
|
|
|
"public key of the exchange (Crockford base32 encoded)",
|
|
|
|
&master_public_key)),
|
2017-03-25 21:22:22 +01:00
|
|
|
GNUNET_GETOPT_option_string ('u',
|
2017-03-15 12:01:06 +01:00
|
|
|
"auditor-url",
|
|
|
|
"URL",
|
|
|
|
"URL of the auditor (informative link for the user)",
|
|
|
|
&auditor_url),
|
2017-03-25 21:22:22 +01:00
|
|
|
GNUNET_GETOPT_option_mandatory
|
|
|
|
(GNUNET_GETOPT_option_filename ('r',
|
2017-03-15 12:01:06 +01:00
|
|
|
"exchange-request",
|
|
|
|
"FILENAME",
|
|
|
|
"set of keys the exchange requested the auditor to sign",
|
|
|
|
&exchange_request_file)),
|
2017-03-25 21:22:22 +01:00
|
|
|
GNUNET_GETOPT_option_filename ('o',
|
2017-03-15 12:01:06 +01:00
|
|
|
"output",
|
|
|
|
"FILENAME",
|
|
|
|
"where to write our signature",
|
|
|
|
&output_file),
|
2017-03-25 21:22:22 +01:00
|
|
|
GNUNET_GETOPT_option_version (VERSION "-" VCS_VERSION),
|
|
|
|
GNUNET_GETOPT_option_verbose (&verbose),
|
2015-07-06 09:10:36 +02:00
|
|
|
GNUNET_GETOPT_OPTION_END
|
|
|
|
};
|
|
|
|
struct GNUNET_CRYPTO_EddsaPrivateKey *eddsa_priv;
|
2015-09-19 16:34:27 +02:00
|
|
|
struct TALER_AuditorSignatureP *sigs;
|
2015-09-17 14:13:41 +02:00
|
|
|
struct TALER_AuditorPublicKeyP apub;
|
2015-07-06 09:10:36 +02:00
|
|
|
struct GNUNET_DISK_FileHandle *fh;
|
2015-09-16 19:18:48 +02:00
|
|
|
struct TALER_DenominationKeyValidityPS *dks;
|
2015-09-17 14:13:41 +02:00
|
|
|
unsigned int dks_len;
|
2016-03-01 15:35:04 +01:00
|
|
|
struct TALER_ExchangeKeyValidityPS kv;
|
2015-07-06 09:10:36 +02:00
|
|
|
off_t in_size;
|
|
|
|
|
|
|
|
GNUNET_assert (GNUNET_OK ==
|
2016-04-10 17:10:20 +02:00
|
|
|
GNUNET_log_setup ("taler-auditor-sign",
|
2015-07-06 09:10:36 +02:00
|
|
|
"WARNING",
|
|
|
|
NULL));
|
2016-04-10 17:10:20 +02:00
|
|
|
if (GNUNET_GETOPT_run ("taler-auditor-sign",
|
2015-07-06 09:10:36 +02:00
|
|
|
options,
|
|
|
|
argc, argv) < 0)
|
|
|
|
return 1;
|
2016-04-10 17:10:20 +02:00
|
|
|
cfg = GNUNET_CONFIGURATION_create ();
|
2017-09-13 14:29:07 +02:00
|
|
|
if (GNUNET_SYSERR ==
|
|
|
|
GNUNET_CONFIGURATION_load (cfg,
|
|
|
|
cfgfile))
|
2016-04-10 17:10:20 +02:00
|
|
|
{
|
|
|
|
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
|
|
|
_("Malformed configuration file `%s', exit ...\n"),
|
|
|
|
cfgfile);
|
|
|
|
GNUNET_free_non_null (cfgfile);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
GNUNET_free_non_null (cfgfile);
|
|
|
|
if ( (NULL == auditor_key_file) &&
|
|
|
|
(GNUNET_OK !=
|
|
|
|
GNUNET_CONFIGURATION_get_value_filename (cfg,
|
|
|
|
"auditor",
|
|
|
|
"AUDITOR_PRIV_FILE",
|
|
|
|
&auditor_key_file)) )
|
2015-07-06 09:10:36 +02:00
|
|
|
{
|
|
|
|
fprintf (stderr,
|
2016-04-10 17:10:20 +02:00
|
|
|
"Auditor key file not given in neither configuration nor command-line\n");
|
2015-07-06 09:10:36 +02:00
|
|
|
return 1;
|
|
|
|
}
|
2016-04-10 17:10:20 +02:00
|
|
|
if ( (NULL == auditor_url) &&
|
|
|
|
(GNUNET_OK !=
|
|
|
|
GNUNET_CONFIGURATION_get_value_string (cfg,
|
|
|
|
"auditor",
|
|
|
|
"AUDITOR_URL",
|
|
|
|
&auditor_url)) )
|
2016-03-21 01:45:53 +01:00
|
|
|
{
|
|
|
|
fprintf (stderr,
|
2017-03-15 12:01:06 +01:00
|
|
|
"Auditor URL not given in neither configuration nor command-line\n");
|
2016-03-21 01:45:53 +01:00
|
|
|
return 1;
|
|
|
|
}
|
2017-07-14 17:43:07 +02:00
|
|
|
if (GNUNET_YES !=
|
|
|
|
GNUNET_DISK_file_test (auditor_key_file))
|
2016-05-05 15:03:43 +02:00
|
|
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
|
|
|
"Auditor private key `%s' does not exist yet, creating it!\n",
|
|
|
|
auditor_key_file);
|
2015-07-06 09:10:36 +02:00
|
|
|
eddsa_priv = GNUNET_CRYPTO_eddsa_key_create_from_file (auditor_key_file);
|
|
|
|
if (NULL == eddsa_priv)
|
|
|
|
{
|
|
|
|
fprintf (stderr,
|
|
|
|
"Failed to initialize auditor key from file `%s'\n",
|
|
|
|
auditor_key_file);
|
|
|
|
return 1;
|
|
|
|
}
|
2015-09-17 14:13:41 +02:00
|
|
|
GNUNET_CRYPTO_eddsa_key_get_public (eddsa_priv,
|
|
|
|
&apub.eddsa_pub);
|
2016-03-01 15:35:04 +01:00
|
|
|
fh = GNUNET_DISK_file_open (exchange_request_file,
|
2015-07-06 09:10:36 +02:00
|
|
|
GNUNET_DISK_OPEN_READ,
|
|
|
|
GNUNET_DISK_PERM_NONE);
|
|
|
|
if (NULL == fh)
|
|
|
|
{
|
|
|
|
fprintf (stderr,
|
|
|
|
"Failed to open file `%s': %s\n",
|
2016-03-01 15:35:04 +01:00
|
|
|
exchange_request_file,
|
2015-07-06 09:10:36 +02:00
|
|
|
STRERROR (errno));
|
2015-09-19 16:34:27 +02:00
|
|
|
GNUNET_free (eddsa_priv);
|
2015-07-06 09:10:36 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
if (GNUNET_OK !=
|
|
|
|
GNUNET_DISK_file_handle_size (fh,
|
|
|
|
&in_size))
|
|
|
|
{
|
|
|
|
fprintf (stderr,
|
|
|
|
"Failed to obtain input file size `%s': %s\n",
|
2016-03-01 15:35:04 +01:00
|
|
|
exchange_request_file,
|
2015-07-06 09:10:36 +02:00
|
|
|
STRERROR (errno));
|
|
|
|
GNUNET_DISK_file_close (fh);
|
2015-09-19 16:34:27 +02:00
|
|
|
GNUNET_free (eddsa_priv);
|
2015-07-06 09:10:36 +02:00
|
|
|
return 1;
|
|
|
|
}
|
2015-09-16 19:18:48 +02:00
|
|
|
if (0 != (in_size % sizeof (struct TALER_DenominationKeyValidityPS)))
|
|
|
|
{
|
|
|
|
fprintf (stderr,
|
|
|
|
"Input file size of file `%s' is invalid\n",
|
2016-03-01 15:35:04 +01:00
|
|
|
exchange_request_file);
|
2015-09-16 19:18:48 +02:00
|
|
|
GNUNET_DISK_file_close (fh);
|
2015-09-19 16:34:27 +02:00
|
|
|
GNUNET_free (eddsa_priv);
|
2015-09-16 19:18:48 +02:00
|
|
|
return 1;
|
|
|
|
}
|
2015-09-17 14:13:41 +02:00
|
|
|
dks_len = in_size / sizeof (struct TALER_DenominationKeyValidityPS);
|
2017-05-18 13:44:07 +02:00
|
|
|
if (0 == dks_len)
|
|
|
|
{
|
|
|
|
fprintf (stderr,
|
|
|
|
"Denomination list has length zero, signature not produced.\n");
|
|
|
|
GNUNET_DISK_file_close (fh);
|
|
|
|
GNUNET_free (eddsa_priv);
|
2017-09-13 14:29:07 +02:00
|
|
|
return 2;
|
2017-07-14 17:43:07 +02:00
|
|
|
}
|
|
|
|
if (NULL ==
|
|
|
|
(adb = TALER_AUDITORDB_plugin_load (cfg)))
|
|
|
|
{
|
|
|
|
fprintf (stderr,
|
|
|
|
"Failed to initialize auditor database plugin.\n");
|
|
|
|
GNUNET_DISK_file_close (fh);
|
|
|
|
GNUNET_free (eddsa_priv);
|
|
|
|
return 3;
|
2017-05-18 13:44:07 +02:00
|
|
|
}
|
2017-09-13 14:29:07 +02:00
|
|
|
|
2016-03-01 15:35:04 +01:00
|
|
|
kv.purpose.purpose = htonl (TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS);
|
|
|
|
kv.purpose.size = htonl (sizeof (struct TALER_ExchangeKeyValidityPS));
|
2016-03-21 01:45:53 +01:00
|
|
|
GNUNET_CRYPTO_hash (auditor_url,
|
|
|
|
strlen (auditor_url) + 1,
|
|
|
|
&kv.auditor_url_hash);
|
2015-09-19 16:34:27 +02:00
|
|
|
kv.master = master_public_key;
|
|
|
|
dks = GNUNET_new_array (dks_len,
|
|
|
|
struct TALER_DenominationKeyValidityPS);
|
|
|
|
sigs = GNUNET_new_array (dks_len,
|
|
|
|
struct TALER_AuditorSignatureP);
|
2015-09-16 19:18:48 +02:00
|
|
|
if (in_size !=
|
|
|
|
GNUNET_DISK_file_read (fh,
|
|
|
|
dks,
|
|
|
|
in_size))
|
|
|
|
{
|
|
|
|
fprintf (stderr,
|
|
|
|
"Failed to read input file `%s': %s\n",
|
2016-03-01 15:35:04 +01:00
|
|
|
exchange_request_file,
|
2015-09-16 19:18:48 +02:00
|
|
|
STRERROR (errno));
|
2017-07-14 17:43:07 +02:00
|
|
|
TALER_AUDITORDB_plugin_unload (adb);
|
2015-09-16 19:18:48 +02:00
|
|
|
GNUNET_DISK_file_close (fh);
|
2015-09-19 16:34:27 +02:00
|
|
|
GNUNET_free (sigs);
|
|
|
|
GNUNET_free (dks);
|
|
|
|
GNUNET_free (eddsa_priv);
|
2015-09-16 19:18:48 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
GNUNET_DISK_file_close (fh);
|
2017-07-14 17:43:07 +02:00
|
|
|
for (unsigned int i=0;i<dks_len;i++)
|
2015-09-16 19:18:48 +02:00
|
|
|
{
|
2015-09-19 16:34:27 +02:00
|
|
|
struct TALER_DenominationKeyValidityPS *dk = &dks[i];
|
|
|
|
|
|
|
|
if (verbose)
|
|
|
|
print_dk (dk);
|
|
|
|
kv.start = dk->start;
|
|
|
|
kv.expire_withdraw = dk->expire_withdraw;
|
2016-05-02 05:10:40 +02:00
|
|
|
kv.expire_deposit = dk->expire_deposit;
|
2015-09-19 16:34:27 +02:00
|
|
|
kv.expire_legal = dk->expire_legal;
|
|
|
|
kv.value = dk->value;
|
|
|
|
kv.fee_withdraw = dk->fee_withdraw;
|
|
|
|
kv.fee_deposit = dk->fee_deposit;
|
|
|
|
kv.fee_refresh = dk->fee_refresh;
|
2017-05-11 11:02:49 +02:00
|
|
|
kv.fee_refund = dk->fee_refund;
|
2015-09-19 16:34:27 +02:00
|
|
|
kv.denom_hash = dk->denom_hash;
|
|
|
|
|
|
|
|
/* Finally sign ... */
|
|
|
|
GNUNET_CRYPTO_eddsa_sign (eddsa_priv,
|
|
|
|
&kv.purpose,
|
|
|
|
&sigs[i].eddsa_sig);
|
2015-09-16 19:18:48 +02:00
|
|
|
}
|
|
|
|
|
2015-07-06 09:10:36 +02:00
|
|
|
if (NULL == output_file)
|
|
|
|
{
|
|
|
|
fprintf (stderr,
|
|
|
|
"Output file not given\n");
|
2017-07-14 17:43:07 +02:00
|
|
|
TALER_AUDITORDB_plugin_unload (adb);
|
2015-09-19 16:34:27 +02:00
|
|
|
GNUNET_free (dks);
|
|
|
|
GNUNET_free (sigs);
|
|
|
|
GNUNET_free (eddsa_priv);
|
2015-07-06 09:10:36 +02:00
|
|
|
return 1;
|
|
|
|
}
|
2017-09-13 14:29:07 +02:00
|
|
|
|
|
|
|
/* Create required tables */
|
|
|
|
if (GNUNET_OK !=
|
|
|
|
adb->create_tables (adb->cls))
|
|
|
|
{
|
|
|
|
fprintf (stderr,
|
|
|
|
"Failed to create tables in auditor's database\n");
|
|
|
|
TALER_AUDITORDB_plugin_unload (adb);
|
|
|
|
GNUNET_free (dks);
|
|
|
|
GNUNET_free (sigs);
|
|
|
|
GNUNET_free (eddsa_priv);
|
|
|
|
return 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-07-14 17:43:07 +02:00
|
|
|
/* Update DB */
|
|
|
|
{
|
|
|
|
enum GNUNET_DB_QueryStatus qs;
|
|
|
|
struct TALER_AUDITORDB_Session *session;
|
|
|
|
|
|
|
|
session = adb->get_session (adb->cls);
|
|
|
|
if (NULL == session)
|
|
|
|
{
|
|
|
|
fprintf (stderr,
|
|
|
|
"Failed to initialize database session\n");
|
|
|
|
TALER_AUDITORDB_plugin_unload (adb);
|
|
|
|
GNUNET_free (dks);
|
|
|
|
GNUNET_free (sigs);
|
|
|
|
GNUNET_free (eddsa_priv);
|
|
|
|
return 3;
|
|
|
|
}
|
|
|
|
for (unsigned int i=0;i<dks_len;i++)
|
|
|
|
{
|
|
|
|
const struct TALER_DenominationKeyValidityPS *dk = &dks[i];
|
|
|
|
|
|
|
|
qs = adb->insert_denomination_info (adb->cls,
|
|
|
|
session,
|
|
|
|
dk);
|
|
|
|
if (0 > qs)
|
|
|
|
{
|
|
|
|
fprintf (stderr,
|
|
|
|
"Failed to store key in auditor DB\n");
|
|
|
|
TALER_AUDITORDB_plugin_unload (adb);
|
|
|
|
GNUNET_free (dks);
|
|
|
|
GNUNET_free (sigs);
|
|
|
|
GNUNET_free (eddsa_priv);
|
|
|
|
return 3;
|
|
|
|
}
|
|
|
|
}
|
2017-09-13 14:29:07 +02:00
|
|
|
}
|
2017-07-14 17:43:07 +02:00
|
|
|
TALER_AUDITORDB_plugin_unload (adb);
|
2015-07-06 09:10:36 +02:00
|
|
|
|
2015-09-17 14:13:41 +02:00
|
|
|
/* write result to disk */
|
|
|
|
if (GNUNET_OK !=
|
2016-03-01 15:35:04 +01:00
|
|
|
TALER_EXCHANGEDB_auditor_write (output_file,
|
2016-03-21 01:45:53 +01:00
|
|
|
&apub,
|
|
|
|
auditor_url,
|
|
|
|
sigs,
|
|
|
|
&master_public_key,
|
|
|
|
dks_len,
|
|
|
|
dks))
|
2015-09-16 19:18:48 +02:00
|
|
|
{
|
|
|
|
fprintf (stderr,
|
|
|
|
"Failed to write to file `%s': %s\n",
|
|
|
|
output_file,
|
|
|
|
STRERROR (errno));
|
2015-09-19 16:34:27 +02:00
|
|
|
GNUNET_free (sigs);
|
|
|
|
GNUNET_free (dks);
|
2015-09-16 19:18:48 +02:00
|
|
|
return 1;
|
|
|
|
}
|
2015-09-19 16:34:27 +02:00
|
|
|
GNUNET_free (sigs);
|
|
|
|
GNUNET_free (dks);
|
2015-07-06 09:10:36 +02:00
|
|
|
GNUNET_free (eddsa_priv);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* end of taler-auditor-sign.c */
|