diff options
| author | Christian Grothoff <christian@grothoff.org> | 2015-08-11 14:40:09 +0200 | 
|---|---|---|
| committer | Christian Grothoff <christian@grothoff.org> | 2015-08-11 14:40:09 +0200 | 
| commit | 13619f425c4f97cf0d7cffd3a35faba6ef3c654a (patch) | |
| tree | 93ec034889a06cc5f4471a086036af4eb80fb713 /src/mint-tools | |
| parent | 655e6f17bdb174bcbfb00cded2a500465db7e40a (diff) | |
towards implementing /wire replies
Diffstat (limited to 'src/mint-tools')
| -rw-r--r-- | src/mint-tools/Makefile.am | 10 | ||||
| -rw-r--r-- | src/mint-tools/taler-mint-sepa.c | 111 | 
2 files changed, 120 insertions, 1 deletions
diff --git a/src/mint-tools/Makefile.am b/src/mint-tools/Makefile.am index 9849bbc5..b76d9b68 100644 --- a/src/mint-tools/Makefile.am +++ b/src/mint-tools/Makefile.am @@ -10,6 +10,7 @@ bin_PROGRAMS = \    taler-mint-keyup \    taler-mint-keycheck \    taler-mint-reservemod \ +  taler-mint-sepa \    taler-mint-dbinit  taler_mint_keyup_SOURCES = \ @@ -24,9 +25,16 @@ taler_mint_keyup_LDADD = \  taler_mint_keyup_LDFLAGS = $(POSTGRESQL_LDFLAGS) +taler_mint_sepa_SOURCES = \ +  taler-mint-sepa.c +taler_mint_sepa_LDADD = \ +  $(LIBGCRYPT_LIBS) \ +  $(top_builddir)/src/util/libtalerutil.la \ +  -lgnunetutil  $(XLIB) +taler_mint_sepa_LDFLAGS = $(POSTGRESQL_LDFLAGS) +  taler_mint_keycheck_SOURCES = \    taler-mint-keycheck.c -  taler_mint_keycheck_LDADD = \    $(LIBGCRYPT_LIBS) \    $(top_builddir)/src/util/libtalerutil.la \ diff --git a/src/mint-tools/taler-mint-sepa.c b/src/mint-tools/taler-mint-sepa.c new file mode 100644 index 00000000..9c7060b5 --- /dev/null +++ b/src/mint-tools/taler-mint-sepa.c @@ -0,0 +1,111 @@ +/* +  This file is part of TALER +  Copyright (C) 2015 Christian Grothoff (and other contributing authors) + +  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 +  TALER; see the file COPYING.  If not, If not, see <http://www.gnu.org/licenses/> +*/ +/** + * @file taler-mint-sepa.c + * @brief Create signed response for /wire/sepa requests. + * @author Christian Grothoff + */ +#include <platform.h> +#include "taler_crypto_lib.h" + +/** + * Filename of the master private key. + */ +static char *masterkeyfile; + +/** + * Account holder name. + */ +static char *sepa_name; + +/** + * IBAN number. + */ +static char *iban; + +/** + * BIC number. + */ +static char *bic; + +/** + * Where to write the result. + */ +static char *output_filename; + + +/** + * The main function of the taler-mint-sepa tool.  This tool is used + * to sign the SEPA bank account details using the master key. + * + * @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) +{ +  static const struct GNUNET_GETOPT_CommandLineOption options[] = { +    {'b', "bic", "BICCODE", +     "bank BIC code", 1, +     &GNUNET_GETOPT_set_string, &bic}, +    {'i', "iban", "IBAN", +     "IBAN number of the account", 1, +     &GNUNET_GETOPT_set_string, &iban}, +    {'m', "master-key", "FILE", +     "master key file (private key)", 1, +     &GNUNET_GETOPT_set_filename, &masterkeyfile}, +    {'n', "name", "NAME", +     "name of the account holder", 1, +     &GNUNET_GETOPT_set_string, &sepa_name}, +    {'o', "output", "FILE", +     "where to write the result", 1, +     &GNUNET_GETOPT_set_filename, &output_filename}, +    GNUNET_GETOPT_OPTION_VERSION (VERSION "-" VCS_VERSION), +    GNUNET_GETOPT_OPTION_END +  }; +  struct GNUNET_CRYPTO_EddsaPrivateKey *eddsa_priv; + +  GNUNET_assert (GNUNET_OK == +                 GNUNET_log_setup ("taler-mint-sepa", +                                   "WARNING", +                                   NULL)); + +  if (GNUNET_GETOPT_run ("taler-mint-sepa", +                         options, +                         argc, argv) < 0) +    return 1; +  if (NULL == masterkeyfile) +  { +    fprintf (stderr, +             "Master key file not given\n"); +    return 1; +  } +  eddsa_priv = GNUNET_CRYPTO_eddsa_key_create_from_file (masterkeyfile); +  if (NULL == eddsa_priv) +  { +    fprintf (stderr, +             "Failed to initialize master key from file `%s'\n", +             masterkeyfile); +    return 1; +  } +  /* FIXME: do real work! */ +  GNUNET_free (eddsa_priv); +  return 0; +} + +/* end of taler-mint-sepa.c */  | 
