diff options
Diffstat (limited to 'src/testing')
18 files changed, 683 insertions, 505 deletions
diff --git a/src/testing/.gitignore b/src/testing/.gitignore index 61e3a4c0..700bda4c 100644 --- a/src/testing/.gitignore +++ b/src/testing/.gitignore @@ -1,13 +1,16 @@ -test_auditor_api_version +test_auditor_api_version_cs +test_auditor_api_version_rsa  test_bank_api_with_fakebank  test_bank_api_with_fakebank_twisted  test_bank_api_with_pybank  test_bank_api_with_pybank_twisted  test_taler_exchange_aggregator-postgres  test_taler_exchange_wirewatch-postgres -test_exchange_api_revocation +test_exchange_api_revocation_cs +test_exchange_api_revocation_rsa  report* -test_exchange_management_api +test_exchange_management_api_cs +test_exchange_management_api_rsa  test_exchange_api_home/.local/share/taler/crypto-eddsa/  test_exchange_api_home/.local/share/taler/crypto-rsa/  test_exchange_api_home/.local/share/taler/exchange/offline-keys/secm_tofus.priv diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am index bc78217b..71200175 100644 --- a/src/testing/Makefile.am +++ b/src/testing/Makefile.am @@ -114,16 +114,23 @@ AM_TESTS_ENVIRONMENT=export TALER_PREFIX=$${TALER_PREFIX:-@libdir@};export PATH=  .NOTPARALLEL:  check_PROGRAMS = \ -  test_auditor_api \ -  test_auditor_api_version \ +  test_auditor_api_cs \ +  test_auditor_api_rsa \ +  test_auditor_api_version_rsa \ +  test_auditor_api_version_cs \    test_bank_api_with_fakebank \    test_bank_api_with_pybank \    test_bank_api_with_nexus \ -  test_exchange_api \ -  test_exchange_api_keys_cherry_picking \ -  test_exchange_api_revocation \ -  test_exchange_api_overlapping_keys_bug \ -  test_exchange_management_api \ +  test_exchange_api_cs \ +  test_exchange_api_rsa \ +  test_exchange_api_keys_cherry_picking_cs \ +  test_exchange_api_keys_cherry_picking_rsa \ +  test_exchange_api_revocation_cs \ +  test_exchange_api_revocation_rsa \ +  test_exchange_api_overlapping_keys_bug_cs \ +  test_exchange_api_overlapping_keys_bug_rsa \ +  test_exchange_management_api_cs \ +  test_exchange_management_api_rsa \    test_kyc_api \    test_taler_exchange_aggregator-postgres \    test_taler_exchange_wirewatch-postgres @@ -139,9 +146,9 @@ endif  TESTS = \    $(check_PROGRAMS) -test_auditor_api_SOURCES = \ +test_auditor_api_cs_SOURCES = \    test_auditor_api.c -test_auditor_api_LDADD = \ +test_auditor_api_cs_LDADD = \    $(top_builddir)/src/lib/libtalerauditor.la \    libtalertesting.la \    $(top_builddir)/src/lib/libtalerexchange.la \ @@ -155,10 +162,38 @@ test_auditor_api_LDADD = \    -ljansson \    $(XLIB) +test_auditor_api_rsa_SOURCES = \ +  test_auditor_api.c +test_auditor_api_rsa_LDADD = \ +  $(top_builddir)/src/lib/libtalerauditor.la \ +  libtalertesting.la \ +  $(top_builddir)/src/lib/libtalerexchange.la \ +  $(LIBGCRYPT_LIBS) \ +  $(top_builddir)/src/bank-lib/libtalerfakebank.la \ +  $(top_builddir)/src/bank-lib/libtalerbank.la \ +  $(top_builddir)/src/json/libtalerjson.la \ +  $(top_builddir)/src/util/libtalerutil.la \ +  -lgnunetcurl \ +  -lgnunetutil \ +  -ljansson \ +  $(XLIB) + + +test_auditor_api_version_cs_SOURCES = \ +  test_auditor_api_version.c +test_auditor_api_version_cs_LDADD = \ +  libtalertesting.la \ +  $(top_builddir)/src/lib/libtalerauditor.la \ +  $(LIBGCRYPT_LIBS) \ +  $(top_builddir)/src/util/libtalerutil.la \ +  -lgnunetcurl \ +  -lgnunetutil \ +  -ljansson \ +  $(XLIB) -test_auditor_api_version_SOURCES = \ +test_auditor_api_version_rsa_SOURCES = \    test_auditor_api_version.c -test_auditor_api_version_LDADD = \ +test_auditor_api_version_rsa_LDADD = \    libtalertesting.la \    $(top_builddir)/src/lib/libtalerauditor.la \    $(LIBGCRYPT_LIBS) \ @@ -195,9 +230,9 @@ test_bank_api_with_pybank_LDADD = \    $(top_builddir)/src/bank-lib/libtalerbank.la \    $(XLIB) -test_exchange_api_SOURCES = \ +test_exchange_api_cs_SOURCES = \    test_exchange_api.c -test_exchange_api_LDADD = \ +test_exchange_api_cs_LDADD = \    libtalertesting.la \    $(top_builddir)/src/lib/libtalerexchange.la \    $(LIBGCRYPT_LIBS) \ @@ -210,18 +245,52 @@ test_exchange_api_LDADD = \    -ljansson \    $(XLIB) -test_exchange_management_api_SOURCES = \ -  test_exchange_management_api.c -test_exchange_management_api_LDADD = \ +test_exchange_api_rsa_SOURCES = \ +  test_exchange_api.c +test_exchange_api_rsa_LDADD = \ +  libtalertesting.la \ +  $(top_builddir)/src/lib/libtalerexchange.la \ +  $(LIBGCRYPT_LIBS) \ +  $(top_builddir)/src/bank-lib/libtalerfakebank.la \ +  $(top_builddir)/src/bank-lib/libtalerbank.la \ +  $(top_builddir)/src/json/libtalerjson.la \ +  $(top_builddir)/src/util/libtalerutil.la \ +  -lgnunetcurl \ +  -lgnunetutil \ +  -ljansson \ +  $(XLIB) + +test_exchange_api_keys_cherry_picking_cs_SOURCES = \ +  test_exchange_api_keys_cherry_picking.c +test_exchange_api_keys_cherry_picking_cs_LDADD = \    libtalertesting.la \    $(top_builddir)/src/lib/libtalerexchange.la \ +  $(LIBGCRYPT_LIBS) \ +  $(top_builddir)/src/json/libtalerjson.la \    $(top_builddir)/src/util/libtalerutil.la \ +  $(top_builddir)/src/bank-lib/libtalerbank.la \ +  -lgnunetcurl \    -lgnunetutil \ +  -ljansson \    $(XLIB) -test_exchange_api_revocation_SOURCES = \ +test_exchange_api_keys_cherry_picking_rsa_SOURCES = \ +  test_exchange_api_keys_cherry_picking.c +test_exchange_api_keys_cherry_picking_rsa_LDADD = \ +  libtalertesting.la \ +  $(top_builddir)/src/lib/libtalerexchange.la \ +  $(LIBGCRYPT_LIBS) \ +  $(top_builddir)/src/json/libtalerjson.la \ +  $(top_builddir)/src/util/libtalerutil.la \ +  $(top_builddir)/src/bank-lib/libtalerbank.la \ +  -lgnunetcurl \ +  -lgnunetutil \ +  -ljansson \ +  $(XLIB) + +test_exchange_api_revocation_cs_SOURCES = \    test_exchange_api_revocation.c -test_exchange_api_revocation_LDADD = \ +test_exchange_api_revocation_cs_LDADD = \    libtalertesting.la \    $(top_builddir)/src/lib/libtalerexchange.la \    $(LIBGCRYPT_LIBS) \ @@ -234,9 +303,25 @@ test_exchange_api_revocation_LDADD = \    -ljansson \    $(XLIB) -test_exchange_api_keys_cherry_picking_SOURCES = \ -  test_exchange_api_keys_cherry_picking.c -test_exchange_api_keys_cherry_picking_LDADD = \ +test_exchange_api_revocation_rsa_SOURCES = \ +  test_exchange_api_revocation.c +test_exchange_api_revocation_rsa_LDADD = \ +  libtalertesting.la \ +  $(top_builddir)/src/lib/libtalerexchange.la \ +  $(LIBGCRYPT_LIBS) \ +  $(top_builddir)/src/bank-lib/libtalerfakebank.la \ +  $(top_builddir)/src/bank-lib/libtalerbank.la \ +  $(top_builddir)/src/json/libtalerjson.la \ +  $(top_builddir)/src/util/libtalerutil.la \ +  -lgnunetcurl \ +  -lgnunetutil \ +  -ljansson \ +  $(XLIB) + + +test_exchange_api_overlapping_keys_bug_cs_SOURCES = \ +  test_exchange_api_overlapping_keys_bug.c +test_exchange_api_overlapping_keys_bug_cs_LDADD = \    libtalertesting.la \    $(top_builddir)/src/lib/libtalerexchange.la \    $(LIBGCRYPT_LIBS) \ @@ -248,9 +333,9 @@ test_exchange_api_keys_cherry_picking_LDADD = \    -ljansson \    $(XLIB) -test_exchange_api_overlapping_keys_bug_SOURCES = \ +test_exchange_api_overlapping_keys_bug_rsa_SOURCES = \    test_exchange_api_overlapping_keys_bug.c -test_exchange_api_overlapping_keys_bug_LDADD = \ +test_exchange_api_overlapping_keys_bug_rsa_LDADD = \    libtalertesting.la \    $(top_builddir)/src/lib/libtalerexchange.la \    $(LIBGCRYPT_LIBS) \ @@ -262,6 +347,25 @@ test_exchange_api_overlapping_keys_bug_LDADD = \    -ljansson \    $(XLIB) +test_exchange_management_api_cs_SOURCES = \ +  test_exchange_management_api.c +test_exchange_management_api_cs_LDADD = \ +  libtalertesting.la \ +  $(top_builddir)/src/lib/libtalerexchange.la \ +  $(top_builddir)/src/util/libtalerutil.la \ +  -lgnunetutil \ +  $(XLIB) + +test_exchange_management_api_rsa_SOURCES = \ +  test_exchange_management_api.c +test_exchange_management_api_rsa_LDADD = \ +  libtalertesting.la \ +  $(top_builddir)/src/lib/libtalerexchange.la \ +  $(top_builddir)/src/util/libtalerutil.la \ +  -lgnunetutil \ +  $(XLIB) + +  test_taler_exchange_aggregator_postgres_SOURCES = \    test_taler_exchange_aggregator.c  test_taler_exchange_aggregator_postgres_LDADD = \ diff --git a/src/testing/test-taler-exchange-aggregator-postgres.conf b/src/testing/test-taler-exchange-aggregator-postgres.conf index 965f05b0..dfa017d0 100644 --- a/src/testing/test-taler-exchange-aggregator-postgres.conf +++ b/src/testing/test-taler-exchange-aggregator-postgres.conf @@ -94,14 +94,3 @@ fee_refresh = EUR:0.01  fee_refund = EUR:0.01  CIPHER = RSA  rsa_keysize = 1024 - -[coin_eur_ct_2] -value = EUR:0.01 -duration_withdraw = 7 days -duration_spend = 2 years -duration_legal = 3 years -fee_withdraw = EUR:0.00 -fee_deposit = EUR:0.00 -fee_refresh = EUR:0.01 -fee_refund = EUR:0.01 -CIPHER = CS
\ No newline at end of file diff --git a/src/testing/test-taler-exchange-wirewatch-postgres.conf b/src/testing/test-taler-exchange-wirewatch-postgres.conf index 60d973c1..fda1acd7 100644 --- a/src/testing/test-taler-exchange-wirewatch-postgres.conf +++ b/src/testing/test-taler-exchange-wirewatch-postgres.conf @@ -83,14 +83,3 @@ fee_refresh = EUR:0.01  fee_refund = EUR:0.01  CIPHER = RSA  rsa_keysize = 1024 - -[coin_eur_ct_11] -value = EUR:0.01 -duration_withdraw = 7 days -duration_spend = 2 years -duration_legal = 3 years -fee_withdraw = EUR:0.00 -fee_deposit = EUR:0.00 -fee_refresh = EUR:0.01 -fee_refund = EUR:0.01 -CIPHER = CS
\ No newline at end of file diff --git a/src/testing/test_auditor_api-cs.conf b/src/testing/test_auditor_api-cs.conf new file mode 100644 index 00000000..fbd84461 --- /dev/null +++ b/src/testing/test_auditor_api-cs.conf @@ -0,0 +1,140 @@ + +# This file is in the public domain. +# +[PATHS] +# Persistent data storage for the testcase +TALER_TEST_HOME = test_exchange_api_home/ +TALER_RUNTIME_DIR = ${TMPDIR:-${TMP:-/tmp}}/${USER:-}/taler-system-runtime/ + +[taler-exchange-secmod-cs] +# Reduce from 1 year to speed up test +LOOKAHEAD_SIGN = 24 days + +[taler-exchange-secmod-eddsa] +# Reduce from 1 year to speed up test +LOOKAHEAD_SIGN = 24 days +# Reduce from 12 weeks to ensure we have multiple +DURATION = 14 days + + +[taler] +# Currency supported by the exchange (can only be one) +CURRENCY = EUR +CURRENCY_ROUND_UNIT = EUR:0.01 + +[auditor] +BASE_URL = "http://localhost:8083/" + +# HTTP port the auditor listens to +PORT = 8083 + +TINY_AMOUNT = EUR:0.01 + +[exchange] + +# HTTP port the exchange listens to +PORT = 8081 + +# Master public key used to sign the exchange's various keys +MASTER_PUBLIC_KEY = 98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG + +# How to access our database +DB = postgres + +# Base URL of the exchange. Must be set to a URL where the +# exchange (or the twister) is actually listening. +BASE_URL = "http://localhost:8081/" + +[exchangedb-postgres] +CONFIG = "postgres:///talercheck" + +[auditordb-postgres] +CONFIG = "postgres:///talercheck" + +# Sections starting with "exchange-account-" configure the bank accounts +# of the exchange.  The "URL" specifies the account in +# payto://-format. +[exchange-account-1] +# What is the URL of our account? +PAYTO_URI = "payto://x-taler-bank/localhost/42" + +[exchange-accountcredentials-1] +WIRE_GATEWAY_URL = "http://localhost:8082/42/" + +[bank] +HTTP_PORT = 8082 + +# ENABLE_CREDIT = YES + +[exchange-account-2] +# What is the bank account (with the "Taler Bank" demo system)? +PAYTO_URI = "payto://x-taler-bank/localhost/2" +ENABLE_DEBIT = YES +ENABLE_CREDIT = YES + +# Authentication information for basic authentication +[exchange-accountcredentials-2] +WIRE_GATEWAY_URL = "http://localhost:8082/2/" +WIRE_GATEWAY_AUTH_METHOD = "basic" +USERNAME = user +PASSWORD = pass + + + + +# Sections starting with "coin_" specify which denominations +# the exchange should support (and their respective fee structure) +[coin_eur_ct_1] +value = EUR:0.01 +duration_withdraw = 7 days +duration_spend = 2 years +duration_legal = 3 years +fee_withdraw = EUR:0.00 +fee_deposit = EUR:0.00 +fee_refresh = EUR:0.01 +fee_refund = EUR:0.01 +CIPHER = CS + +[coin_eur_ct_10] +value = EUR:0.10 +duration_withdraw = 7 days +duration_spend = 2 years +duration_legal = 3 years +fee_withdraw = EUR:0.01 +fee_deposit = EUR:0.01 +fee_refresh = EUR:0.03 +fee_refund = EUR:0.01 +CIPHER = CS + +[coin_eur_1] +value = EUR:1 +duration_withdraw = 7 days +duration_spend = 2 years +duration_legal = 3 years +fee_withdraw = EUR:0.01 +fee_deposit = EUR:0.01 +fee_refresh = EUR:0.03 +fee_refund = EUR:0.01 +CIPHER = CS + +[coin_eur_5] +value = EUR:5 +duration_withdraw = 7 days +duration_spend = 2 years +duration_legal = 3 years +fee_withdraw = EUR:0.01 +fee_deposit = EUR:0.01 +fee_refresh = EUR:0.03 +fee_refund = EUR:0.01 +CIPHER = CS + +[coin_eur_10] +value = EUR:10 +duration_withdraw = 7 days +duration_spend = 2 years +duration_legal = 3 years +fee_withdraw = EUR:0.01 +fee_deposit = EUR:0.01 +fee_refresh = EUR:0.03 +fee_refund = EUR:0.01 +CIPHER = CS diff --git a/src/testing/test_auditor_api-rsa.conf b/src/testing/test_auditor_api-rsa.conf new file mode 100644 index 00000000..95eb47b3 --- /dev/null +++ b/src/testing/test_auditor_api-rsa.conf @@ -0,0 +1,145 @@ + +# This file is in the public domain. +# +[PATHS] +# Persistent data storage for the testcase +TALER_TEST_HOME = test_exchange_api_home/ +TALER_RUNTIME_DIR = ${TMPDIR:-${TMP:-/tmp}}/${USER:-}/taler-system-runtime/ + +[taler-exchange-secmod-rsa] +# Reduce from 1 year to speed up test +LOOKAHEAD_SIGN = 24 days + +[taler-exchange-secmod-eddsa] +# Reduce from 1 year to speed up test +LOOKAHEAD_SIGN = 24 days +# Reduce from 12 weeks to ensure we have multiple +DURATION = 14 days + + +[taler] +# Currency supported by the exchange (can only be one) +CURRENCY = EUR +CURRENCY_ROUND_UNIT = EUR:0.01 + +[auditor] +BASE_URL = "http://localhost:8083/" + +# HTTP port the auditor listens to +PORT = 8083 + +TINY_AMOUNT = EUR:0.01 + +[exchange] + +# HTTP port the exchange listens to +PORT = 8081 + +# Master public key used to sign the exchange's various keys +MASTER_PUBLIC_KEY = 98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG + +# How to access our database +DB = postgres + +# Base URL of the exchange. Must be set to a URL where the +# exchange (or the twister) is actually listening. +BASE_URL = "http://localhost:8081/" + +[exchangedb-postgres] +CONFIG = "postgres:///talercheck" + +[auditordb-postgres] +CONFIG = "postgres:///talercheck" + +# Sections starting with "exchange-account-" configure the bank accounts +# of the exchange.  The "URL" specifies the account in +# payto://-format. +[exchange-account-1] +# What is the URL of our account? +PAYTO_URI = "payto://x-taler-bank/localhost/42" + +[exchange-accountcredentials-1] +WIRE_GATEWAY_URL = "http://localhost:8082/42/" + +[bank] +HTTP_PORT = 8082 + +# ENABLE_CREDIT = YES + +[exchange-account-2] +# What is the bank account (with the "Taler Bank" demo system)? +PAYTO_URI = "payto://x-taler-bank/localhost/2" +ENABLE_DEBIT = YES +ENABLE_CREDIT = YES + +# Authentication information for basic authentication +[exchange-accountcredentials-2] +WIRE_GATEWAY_URL = "http://localhost:8082/2/" +WIRE_GATEWAY_AUTH_METHOD = "basic" +USERNAME = user +PASSWORD = pass + + + + +# Sections starting with "coin_" specify which denominations +# the exchange should support (and their respective fee structure) +[coin_eur_ct_1] +value = EUR:0.01 +duration_withdraw = 7 days +duration_spend = 2 years +duration_legal = 3 years +fee_withdraw = EUR:0.00 +fee_deposit = EUR:0.00 +fee_refresh = EUR:0.01 +fee_refund = EUR:0.01 +CIPHER = RSA +rsa_keysize = 1024 + +[coin_eur_ct_10] +value = EUR:0.10 +duration_withdraw = 7 days +duration_spend = 2 years +duration_legal = 3 years +fee_withdraw = EUR:0.01 +fee_deposit = EUR:0.01 +fee_refresh = EUR:0.03 +fee_refund = EUR:0.01 +CIPHER = RSA +rsa_keysize = 1024 + +[coin_eur_1] +value = EUR:1 +duration_withdraw = 7 days +duration_spend = 2 years +duration_legal = 3 years +fee_withdraw = EUR:0.01 +fee_deposit = EUR:0.01 +fee_refresh = EUR:0.03 +fee_refund = EUR:0.01 +CIPHER = RSA +rsa_keysize = 1024 + +[coin_eur_5] +value = EUR:5 +duration_withdraw = 7 days +duration_spend = 2 years +duration_legal = 3 years +fee_withdraw = EUR:0.01 +fee_deposit = EUR:0.01 +fee_refresh = EUR:0.03 +fee_refund = EUR:0.01 +CIPHER = RSA +rsa_keysize = 1024 + +[coin_eur_10] +value = EUR:10 +duration_withdraw = 7 days +duration_spend = 2 years +duration_legal = 3 years +fee_withdraw = EUR:0.01 +fee_deposit = EUR:0.01 +fee_refresh = EUR:0.03 +fee_refund = EUR:0.01 +CIPHER = RSA +rsa_keysize = 1024 diff --git a/src/testing/test_auditor_api.c b/src/testing/test_auditor_api.c index 90675dd9..6f3b220b 100644 --- a/src/testing/test_auditor_api.c +++ b/src/testing/test_auditor_api.c @@ -39,10 +39,9 @@   * Configuration file we use.  One (big) configuration is used   * for the various components for this test.   */ -#define CONFIG_FILE "test_auditor_api.conf" +static char *config_file; -#define CONFIG_FILE_EXPIRE_RESERVE_NOW \ -  "test_auditor_api_expire_reserve_now.conf" +static char *config_file_expire_reserve_now;  /**   * Exchange configuration data. @@ -61,7 +60,7 @@ static struct TALER_TESTING_BankConfiguration bc;   * @param label label to use for the command.   */  #define CMD_EXEC_WIREWATCH(label) \ -  TALER_TESTING_cmd_exec_wirewatch (label, CONFIG_FILE) +  TALER_TESTING_cmd_exec_wirewatch (label, config_file)  /**   * Execute the taler-exchange-aggregator, closer and transfer commands with @@ -71,8 +70,8 @@ static struct TALER_TESTING_BankConfiguration bc;   */  #define CMD_EXEC_AGGREGATOR(label) \    TALER_TESTING_cmd_sleep (label "-sleep", 1), \ -  TALER_TESTING_cmd_exec_aggregator (label, CONFIG_FILE), \ -  TALER_TESTING_cmd_exec_transfer (label, CONFIG_FILE) +  TALER_TESTING_cmd_exec_aggregator (label, config_file), \ +  TALER_TESTING_cmd_exec_transfer (label, config_file)  /**   * Run wire transfer of funds from some user's account to the @@ -92,7 +91,7 @@ static struct TALER_TESTING_BankConfiguration bc;   * @param label label to use for the command.   */  #define CMD_RUN_AUDITOR(label) \ -  TALER_TESTING_cmd_exec_auditor (label, CONFIG_FILE) +  TALER_TESTING_cmd_exec_auditor (label, config_file)  /** @@ -406,7 +405,7 @@ run (void *cls,      TALER_TESTING_cmd_revoke ("revoke-1",                                MHD_HTTP_OK,                                "recoup-withdraw-coin-1", -                              CONFIG_FILE), +                              config_file),      TALER_TESTING_cmd_recoup ("recoup-1",                                MHD_HTTP_OK,                                "recoup-withdraw-coin-1", @@ -426,9 +425,9 @@ run (void *cls,      CMD_TRANSFER_TO_EXCHANGE ("short-lived-reserve",                                "EUR:5.01"),      TALER_TESTING_cmd_exec_wirewatch ("short-lived-aggregation", -                                      CONFIG_FILE_EXPIRE_RESERVE_NOW), +                                      config_file_expire_reserve_now),      TALER_TESTING_cmd_exec_aggregator ("close-reserves", -                                       CONFIG_FILE_EXPIRE_RESERVE_NOW), +                                       config_file_expire_reserve_now),      /**       * Fill reserve with EUR:2.02, as withdraw fee is 1 ct per       * config, then withdraw two coin, partially spend one, and @@ -466,7 +465,7 @@ run (void *cls,      TALER_TESTING_cmd_revoke ("revoke-2",                                MHD_HTTP_OK,                                "recoup-withdraw-coin-2a", -                              CONFIG_FILE), +                              config_file),      TALER_TESTING_cmd_recoup ("recoup-2",                                MHD_HTTP_OK,                                "recoup-withdraw-coin-2a", @@ -631,7 +630,7 @@ run (void *cls,    struct TALER_TESTING_Command commands[] = {      TALER_TESTING_cmd_exec_offline_sign_fees ("offline-sign-fees", -                                              CONFIG_FILE, +                                              config_file,                                                "EUR:0.01",                                                "EUR:0.01"),      TALER_TESTING_cmd_auditor_add ("add-auditor-OK", @@ -642,11 +641,11 @@ run (void *cls,                                  MHD_HTTP_NO_CONTENT,                                  false),      TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys", -                                              CONFIG_FILE), +                                              config_file),      TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys",                                                  2),      TALER_TESTING_cmd_exec_auditor_offline ("auditor-offline", -                                            CONFIG_FILE), +                                            config_file),      CMD_RUN_AUDITOR ("virgin-auditor"),      TALER_TESTING_cmd_exchanges_with_url ("check-exchange",                                            MHD_HTTP_OK, @@ -682,25 +681,36 @@ int  main (int argc,        char *const *argv)  { +  const char *cipher; +    (void) argc; -  (void) argv;    /* These environment variables get in the way... */    unsetenv ("XDG_DATA_HOME");    unsetenv ("XDG_CONFIG_HOME"); -  GNUNET_log_setup ("test-auditor-api", +  GNUNET_log_setup (argv[0],                      "INFO",                      NULL); +    /* Check fakebank port is available and get configuration data. */    if (GNUNET_OK != -      TALER_TESTING_prepare_fakebank (CONFIG_FILE, +      TALER_TESTING_prepare_fakebank (config_file,                                        "exchange-account-2",                                        &bc))      return 77; -  TALER_TESTING_cleanup_files (CONFIG_FILE); +  cipher = GNUNET_TESTING_get_testname_from_underscore (argv[0]); +  GNUNET_assert (NULL != cipher); +  GNUNET_asprintf (&config_file, +                   "test_auditor_api-%s.conf", +                   cipher); +  GNUNET_asprintf (&config_file_expire_reserve_now, +                   "test_auditor_api_expire_reserve_now-%s.conf", +                   cipher); + +  TALER_TESTING_cleanup_files (config_file);    /* @helpers.  Run keyup, create tables, ... Note: it     * fetches the port number from config in order to see     * if it's available. */ -  switch (TALER_TESTING_prepare_exchange (CONFIG_FILE, +  switch (TALER_TESTING_prepare_exchange (config_file,                                            GNUNET_YES,                                            &ec))    { @@ -717,7 +727,7 @@ main (int argc,           */          TALER_TESTING_auditor_setup (&run,                                       NULL, -                                     CONFIG_FILE)) +                                     config_file))        return 1;      break;    default: diff --git a/src/testing/test_auditor_api.conf b/src/testing/test_exchange_api-cs.conf index 8e3cd28d..3fbf4c3c 100644 --- a/src/testing/test_auditor_api.conf +++ b/src/testing/test_exchange_api-cs.conf @@ -1,6 +1,6 @@ -  # This file is in the public domain.  # +  [PATHS]  # Persistent data storage for the testcase  TALER_TEST_HOME = test_exchange_api_home/ @@ -10,17 +10,12 @@ TALER_RUNTIME_DIR = ${TMPDIR:-${TMP:-/tmp}}/${USER:-}/taler-system-runtime/  # Reduce from 1 year to speed up test  LOOKAHEAD_SIGN = 24 days -[taler-exchange-secmod-cs] -# Reduce from 1 year to speed up test -LOOKAHEAD_SIGN = 24 days -  [taler-exchange-secmod-eddsa]  # Reduce from 1 year to speed up test  LOOKAHEAD_SIGN = 24 days  # Reduce from 12 weeks to ensure we have multiple  DURATION = 14 days -  [taler]  # Currency supported by the exchange (can only be one)  CURRENCY = EUR @@ -32,10 +27,11 @@ BASE_URL = "http://localhost:8083/"  # HTTP port the auditor listens to  PORT = 8083 -TINY_AMOUNT = EUR:0.01 -  [exchange] +TERMS_ETAG = 0 +PRIVACY_ETAG = 0 +  # HTTP port the exchange listens to  PORT = 8081 @@ -61,14 +57,10 @@ CONFIG = "postgres:///talercheck"  [exchange-account-1]  # What is the URL of our account?  PAYTO_URI = "payto://x-taler-bank/localhost/42" +# ENABLE_CREDIT = YES  [exchange-accountcredentials-1] -WIRE_GATEWAY_URL = "http://localhost:8082/42/" - -[bank] -HTTP_PORT = 8082 - -# ENABLE_CREDIT = YES +WIRE_GATEWAY_URL = "http://localhost:9081/42/"  [exchange-account-2]  # What is the bank account (with the "Taler Bank" demo system)? @@ -76,15 +68,20 @@ PAYTO_URI = "payto://x-taler-bank/localhost/2"  ENABLE_DEBIT = YES  ENABLE_CREDIT = YES -# Authentication information for basic authentication  [exchange-accountcredentials-2] -WIRE_GATEWAY_URL = "http://localhost:8082/2/" -WIRE_GATEWAY_AUTH_METHOD = "basic" -USERNAME = user -PASSWORD = pass - +WIRE_GATEWAY_AUTH_METHOD = basic +USERNAME = Exchange +PASSWORD = x +WIRE_GATEWAY_URL = "http://localhost:9081/2/" +[bank] +HTTP_PORT = 9081 +# Enabled extensions +[exchange-extension-age_restriction] +ENABLED = YES +# default age groups: +#AGE_GROUPS = "8:10:12:14:16:18:21"  # Sections starting with "coin_" specify which denominations  # the exchange should support (and their respective fee structure) @@ -97,18 +94,6 @@ fee_withdraw = EUR:0.00  fee_deposit = EUR:0.00  fee_refresh = EUR:0.01  fee_refund = EUR:0.01 -CIPHER = RSA -rsa_keysize = 1024 - -[coin_eur_ct_2] -value = EUR:0.01 -duration_withdraw = 7 days -duration_spend = 2 years -duration_legal = 3 years -fee_withdraw = EUR:0.00 -fee_deposit = EUR:0.00 -fee_refresh = EUR:0.01 -fee_refund = EUR:0.01  CIPHER = CS  [coin_eur_ct_10] @@ -120,11 +105,10 @@ fee_withdraw = EUR:0.01  fee_deposit = EUR:0.01  fee_refresh = EUR:0.03  fee_refund = EUR:0.01 -CIPHER = RSA -rsa_keysize = 1024 +CIPHER = CS -[coin_eur_ct_11] -value = EUR:0.10 +[coin_eur_1] +value = EUR:1  duration_withdraw = 7 days  duration_spend = 2 years  duration_legal = 3 years @@ -134,8 +118,8 @@ fee_refresh = EUR:0.03  fee_refund = EUR:0.01  CIPHER = CS -[coin_eur_1] -value = EUR:1 +[coin_eur_5] +value = EUR:5  duration_withdraw = 7 days  duration_spend = 2 years  duration_legal = 3 years @@ -143,11 +127,10 @@ fee_withdraw = EUR:0.01  fee_deposit = EUR:0.01  fee_refresh = EUR:0.03  fee_refund = EUR:0.01 -CIPHER = RSA -rsa_keysize = 1024 +CIPHER = CS -[coin_eur_2] -value = EUR:1 +[coin_eur_10] +value = EUR:10  duration_withdraw = 7 days  duration_spend = 2 years  duration_legal = 3 years @@ -157,8 +140,20 @@ fee_refresh = EUR:0.03  fee_refund = EUR:0.01  CIPHER = CS -[coin_eur_5] -value = EUR:5 +[coin_eur_ct_1_age_restricted] +value = EUR:0.01 +duration_withdraw = 7 days +duration_spend = 2 years +duration_legal = 3 years +fee_withdraw = EUR:0.00 +fee_deposit = EUR:0.00 +fee_refresh = EUR:0.01 +fee_refund = EUR:0.01 +age_restricted = true +CIPHER = CS + +[coin_eur_ct_10_age_restricted] +value = EUR:0.10  duration_withdraw = 7 days  duration_spend = 2 years  duration_legal = 3 years @@ -166,11 +161,11 @@ fee_withdraw = EUR:0.01  fee_deposit = EUR:0.01  fee_refresh = EUR:0.03  fee_refund = EUR:0.01 -CIPHER = RSA -rsa_keysize = 1024 +age_restricted = true +CIPHER = CS -[coin_eur_6] -value = EUR:5 +[coin_eur_1_age_restricted] +value = EUR:1  duration_withdraw = 7 days  duration_spend = 2 years  duration_legal = 3 years @@ -178,10 +173,11 @@ fee_withdraw = EUR:0.01  fee_deposit = EUR:0.01  fee_refresh = EUR:0.03  fee_refund = EUR:0.01 +age_restricted = true  CIPHER = CS -[coin_eur_10] -value = EUR:10 +[coin_eur_5_age_restricted] +value = EUR:5  duration_withdraw = 7 days  duration_spend = 2 years  duration_legal = 3 years @@ -189,10 +185,10 @@ fee_withdraw = EUR:0.01  fee_deposit = EUR:0.01  fee_refresh = EUR:0.03  fee_refund = EUR:0.01 -CIPHER = RSA -rsa_keysize = 1024 +age_restricted = true +CIPHER = CS -[coin_eur_11] +[coin_eur_10_age_restricted]  value = EUR:10  duration_withdraw = 7 days  duration_spend = 2 years @@ -201,4 +197,5 @@ fee_withdraw = EUR:0.01  fee_deposit = EUR:0.01  fee_refresh = EUR:0.03  fee_refund = EUR:0.01 -CIPHER = CS
\ No newline at end of file +age_restricted = true +CIPHER = CS diff --git a/src/testing/test_exchange_api.c b/src/testing/test_exchange_api.c index ac5dfdc0..d701e4af 100644 --- a/src/testing/test_exchange_api.c +++ b/src/testing/test_exchange_api.c @@ -38,10 +38,9 @@   * Configuration file we use.  One (big) configuration is used   * for the various components for this test.   */ -#define CONFIG_FILE "test_exchange_api.conf" +static char *config_file; -#define CONFIG_FILE_EXPIRE_RESERVE_NOW \ -  "test_exchange_api_expire_reserve_now.conf" +static char *config_file_expire_reserve_now;  /** @@ -62,7 +61,7 @@ static struct TALER_TESTING_BankConfiguration bc;   * @param label label to use for the command.   */  #define CMD_EXEC_WIREWATCH(label) \ -  TALER_TESTING_cmd_exec_wirewatch (label, CONFIG_FILE) +  TALER_TESTING_cmd_exec_wirewatch (label, config_file)  /**   * Execute the taler-exchange-aggregator, closer and transfer commands with @@ -71,8 +70,8 @@ static struct TALER_TESTING_BankConfiguration bc;   * @param label label to use for the command.   */  #define CMD_EXEC_AGGREGATOR(label) \ -  TALER_TESTING_cmd_exec_aggregator (label "-aggregator", CONFIG_FILE), \ -  TALER_TESTING_cmd_exec_transfer (label "-transfer", CONFIG_FILE) +  TALER_TESTING_cmd_exec_aggregator (label "-aggregator", config_file), \ +  TALER_TESTING_cmd_exec_transfer (label "-transfer", config_file)  /** @@ -679,7 +678,7 @@ run (void *cls,      TALER_TESTING_cmd_revoke ("revoke-0-EUR:5",                                MHD_HTTP_OK,                                "recoup-withdraw-coin-1", -                              CONFIG_FILE), +                              config_file),      /* Recoup coin to reserve */      TALER_TESTING_cmd_recoup ("recoup-1",                                MHD_HTTP_OK, @@ -779,14 +778,14 @@ run (void *cls,                                                   bc.exchange_payto,                                                   "short-lived-reserve"),      TALER_TESTING_cmd_exec_wirewatch ("short-lived-aggregation", -                                      CONFIG_FILE_EXPIRE_RESERVE_NOW), +                                      config_file_expire_reserve_now),      TALER_TESTING_cmd_exec_closer ("close-reserves", -                                   CONFIG_FILE_EXPIRE_RESERVE_NOW, +                                   config_file_expire_reserve_now,                                     "EUR:5",                                     "EUR:0.01",                                     "short-lived-reserve"),      TALER_TESTING_cmd_exec_transfer ("close-reserves-transfer", -                                     CONFIG_FILE_EXPIRE_RESERVE_NOW), +                                     config_file_expire_reserve_now),      TALER_TESTING_cmd_status ("short-lived-status",                                "short-lived-reserve", @@ -836,7 +835,7 @@ run (void *cls,      TALER_TESTING_cmd_revoke ("revoke-1-EUR:1",                                MHD_HTTP_OK,                                "recoup-withdraw-coin-2a", -                              CONFIG_FILE), +                              config_file),      /* Check recoup is failing for the coin with the reused coin key */      TALER_TESTING_cmd_recoup ("recoup-2x",                                MHD_HTTP_CONFLICT, @@ -891,145 +890,6 @@ run (void *cls,      TALER_TESTING_cmd_end ()    }; -  /** -   * Test CS withdrawal plus spending. -   */ -  struct TALER_TESTING_Command withdraw_cs[] = { -    /** -     * Move money to the exchange's bank account. -     */ -    CMD_TRANSFER_TO_EXCHANGE ("create-reserve-cs-1", -                              "EUR:6.02"), -    TALER_TESTING_cmd_check_bank_admin_transfer ("check-create-reserve-cs-1", -                                                 "EUR:6.02", -                                                 bc.user42_payto, -                                                 bc.exchange_payto, -                                                 "create-reserve-cs-1"), -    /** -     * Make a reserve exist, according to the previous -     * transfer. -     */ -    CMD_EXEC_WIREWATCH ("wirewatch-cs-1"), -    /** -     * Withdraw EUR:5. -     */ -    TALER_TESTING_cmd_withdraw_cs_amount ("withdraw-cs-coin-1", -                                          "create-reserve-cs-1", -                                          "EUR:5", -                                          MHD_HTTP_OK), -    /** -     * Withdraw EUR:1 using the SAME private coin key as for the previous coin -     * (in violation of the specification, to be detected on spending!). -     */ -    TALER_TESTING_cmd_withdraw_cs_amount_reuse_key ("withdraw-cs-coin-1x", -                                                    "create-reserve-cs-1", -                                                    "EUR:1", -                                                    "withdraw-cs-coin-1", -                                                    MHD_HTTP_OK), -    /** -     * Check the reserve is depleted. -     */ -    TALER_TESTING_cmd_status ("status-cs-1", -                              "create-reserve-cs-1", -                              "EUR:0", -                              MHD_HTTP_OK), -    /* -     * Try to overdraw. -     */ -    TALER_TESTING_cmd_withdraw_cs_amount ("withdraw-cs-coin-2", -                                          "create-reserve-cs-1", -                                          "EUR:5", -                                          MHD_HTTP_CONFLICT), -    // TODO: add test for nonce reuse -    TALER_TESTING_cmd_end () -  }; - -  struct TALER_TESTING_Command spend_cs[] = { -    /** -     * Spend the coin. -     */ -    TALER_TESTING_cmd_deposit ("deposit-cs-simple", -                               "withdraw-cs-coin-1", -                               0, -                               bc.user42_payto, -                               "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", -                               GNUNET_TIME_UNIT_ZERO, -                               "EUR:5", -                               MHD_HTTP_OK), -    TALER_TESTING_cmd_deposit_replay ("deposit-cs-simple-replay", -                                      "deposit-cs-simple", -                                      MHD_HTTP_OK), -    TALER_TESTING_cmd_deposit ("deposit-cs-reused-coin-key-failure", -                               "withdraw-cs-coin-1x", -                               0, -                               bc.user42_payto, -                               "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", -                               GNUNET_TIME_UNIT_ZERO, -                               "EUR:1", -                               MHD_HTTP_CONFLICT), -    /** -     * Try to double spend using different wire details. -     */ -    TALER_TESTING_cmd_deposit ("deposit-cs-double-1", -                               "withdraw-cs-coin-1", -                               0, -                               bc.user43_payto, -                               "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", -                               GNUNET_TIME_UNIT_ZERO, -                               "EUR:5", -                               MHD_HTTP_CONFLICT), -    /* Try to double spend using a different transaction id. -     * The test needs the contract terms to differ. This -     * is currently the case because of the "timestamp" field, -     * which is set automatically by #TALER_TESTING_cmd_deposit(). -     * This could theoretically fail if at some point a deposit -     * command executes in less than 1 ms. */// -    TALER_TESTING_cmd_deposit ("deposit-cs-double-1", -                               "withdraw-cs-coin-1", -                               0, -                               bc.user43_payto, -                               "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", -                               GNUNET_TIME_UNIT_ZERO, -                               "EUR:5", -                               MHD_HTTP_CONFLICT), -    /** -     * Try to double spend with different proposal. -     */ -    TALER_TESTING_cmd_deposit ("deposit-cs-double-2", -                               "withdraw-cs-coin-1", -                               0, -                               bc.user43_payto, -                               "{\"items\":[{\"name\":\"ice cream\",\"value\":2}]}", -                               GNUNET_TIME_UNIT_ZERO, -                               "EUR:5", -                               MHD_HTTP_CONFLICT), -    TALER_TESTING_cmd_end () -  }; - -  // TODO: CS refresh - -  struct TALER_TESTING_Command track_cs[] = { -    /* Try resolving a deposit's WTID, as we never triggered -     * execution of transactions, the answer should be that -     * the exchange knows about the deposit, but has no WTID yet. -     */// -    TALER_TESTING_cmd_track_transaction ("deposit-cs-wtid-found", -                                         "deposit-cs-simple", -                                         0, -                                         MHD_HTTP_ACCEPTED, -                                         NULL), -    /* Try resolving a deposit's WTID for a failed deposit. -     * As the deposit failed, the answer should be that the -     * exchange does NOT know about the deposit. -     */ -    TALER_TESTING_cmd_track_transaction ("deposit-cs-wtid-failing", -                                         "deposit-cs-double-2", -                                         0, -                                         MHD_HTTP_NOT_FOUND, -                                         NULL), -    TALER_TESTING_cmd_end () -  }; -  #define RESERVE_OPEN_CLOSE_CHUNK 4  #define RESERVE_OPEN_CLOSE_ITERATIONS 3 @@ -1047,10 +907,10 @@ run (void *cls,                                    "EUR:20");      reserve_open_close[(i * RESERVE_OPEN_CLOSE_CHUNK) + 1]        = TALER_TESTING_cmd_exec_wirewatch ("reserve-open-close-wirewatch", -                                          CONFIG_FILE_EXPIRE_RESERVE_NOW); +                                          config_file_expire_reserve_now);      reserve_open_close[(i * RESERVE_OPEN_CLOSE_CHUNK) + 2]        = TALER_TESTING_cmd_exec_closer ("reserve-open-close-aggregation", -                                       CONFIG_FILE_EXPIRE_RESERVE_NOW, +                                       config_file_expire_reserve_now,                                         "EUR:19.99",                                         "EUR:0.01",                                         "reserve-open-close-key"); @@ -1074,9 +934,9 @@ run (void *cls,                                    MHD_HTTP_NO_CONTENT,                                    false),        TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys", -                                                CONFIG_FILE), +                                                config_file),        TALER_TESTING_cmd_exec_offline_sign_fees ("offline-sign-fees", -                                                CONFIG_FILE, +                                                config_file,                                                  "EUR:0.01",                                                  "EUR:0.01"),        TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys", @@ -1099,13 +959,6 @@ run (void *cls,                                 refund),        TALER_TESTING_cmd_batch ("recoup",                                 recoup), -      TALER_TESTING_cmd_batch ("withdraw-cs", -                               withdraw_cs), -      TALER_TESTING_cmd_batch ("spend-cs", -                               spend_cs), -      // TODO: Clause Schnorr refresh -      TALER_TESTING_cmd_batch ("track-cs", -                               track_cs),        TALER_TESTING_cmd_batch ("reserve-open-close",                                 reserve_open_close),        /* End the suite. */ @@ -1123,25 +976,34 @@ int  main (int argc,        char *const *argv)  { +  const char *cipher; +    (void) argc; -  (void) argv;    /* These environment variables get in the way... */    unsetenv ("XDG_DATA_HOME");    unsetenv ("XDG_CONFIG_HOME"); -  GNUNET_log_setup ("test-exchange-api", +  GNUNET_log_setup (argv[0],                      "INFO",                      NULL); +  cipher = GNUNET_TESTING_get_testname_from_underscore (argv[0]); +  GNUNET_assert (NULL != cipher); +  GNUNET_asprintf (&config_file, +                   "test_exchange_api-%s.conf", +                   cipher); +  GNUNET_asprintf (&config_file_expire_reserve_now, +                   "test_exchange_api_expire_reserve_now-%s.conf", +                   cipher);    /* Check fakebank port is available and get config */    if (GNUNET_OK != -      TALER_TESTING_prepare_fakebank (CONFIG_FILE, +      TALER_TESTING_prepare_fakebank (config_file,                                        "exchange-account-2",                                        &bc))      return 77; -  TALER_TESTING_cleanup_files (CONFIG_FILE); +  TALER_TESTING_cleanup_files (config_file);    /* @helpers.  Run keyup, create tables, ... Note: it     * fetches the port number from config in order to see     * if it's available. */ -  switch (TALER_TESTING_prepare_exchange (CONFIG_FILE, +  switch (TALER_TESTING_prepare_exchange (config_file,                                            GNUNET_YES,                                            &ec))    { @@ -1158,7 +1020,7 @@ main (int argc,           */          TALER_TESTING_setup_with_exchange (&run,                                             NULL, -                                           CONFIG_FILE)) +                                           config_file))        return 1;      break;    default: diff --git a/src/testing/test_exchange_api.conf b/src/testing/test_exchange_api.conf index 4f9f24f3..cffe3b87 100644 --- a/src/testing/test_exchange_api.conf +++ b/src/testing/test_exchange_api.conf @@ -97,17 +97,6 @@ fee_refund = EUR:0.01  CIPHER = RSA  rsa_keysize = 1024 -[coin_eur_ct_2] -value = EUR:0.01 -duration_withdraw = 7 days -duration_spend = 2 years -duration_legal = 3 years -fee_withdraw = EUR:0.00 -fee_deposit = EUR:0.00 -fee_refresh = EUR:0.01 -fee_refund = EUR:0.01 -CIPHER = CS -  [coin_eur_ct_10]  value = EUR:0.10  duration_withdraw = 7 days @@ -120,17 +109,6 @@ fee_refund = EUR:0.01  CIPHER = RSA  rsa_keysize = 1024 -[coin_eur_ct_11] -value = EUR:0.10 -duration_withdraw = 7 days -duration_spend = 2 years -duration_legal = 3 years -fee_withdraw = EUR:0.01 -fee_deposit = EUR:0.01 -fee_refresh = EUR:0.03 -fee_refund = EUR:0.01 -CIPHER = CS -  [coin_eur_1]  value = EUR:1  duration_withdraw = 7 days @@ -143,17 +121,6 @@ fee_refund = EUR:0.01  CIPHER = RSA  rsa_keysize = 1024 -[coin_eur_2] -value = EUR:1 -duration_withdraw = 7 days -duration_spend = 2 years -duration_legal = 3 years -fee_withdraw = EUR:0.01 -fee_deposit = EUR:0.01 -fee_refresh = EUR:0.03 -fee_refund = EUR:0.01 -CIPHER = CS -  [coin_eur_5]  value = EUR:5  duration_withdraw = 7 days @@ -166,17 +133,6 @@ fee_refund = EUR:0.01  CIPHER = RSA  rsa_keysize = 1024 -[coin_eur_6] -value = EUR:5 -duration_withdraw = 7 days -duration_spend = 2 years -duration_legal = 3 years -fee_withdraw = EUR:0.01 -fee_deposit = EUR:0.01 -fee_refresh = EUR:0.03 -fee_refund = EUR:0.01 -CIPHER = CS -  [coin_eur_10]  value = EUR:10  duration_withdraw = 7 days @@ -241,7 +197,6 @@ rsa_keysize = 1024  age_restricted = true  CIPHER = RSA -  [coin_eur_10_age_restricted]  value = EUR:10  duration_withdraw = 7 days diff --git a/src/testing/test_exchange_api_keys_cherry_picking-cs.conf b/src/testing/test_exchange_api_keys_cherry_picking-cs.conf new file mode 100644 index 00000000..8967d6c0 --- /dev/null +++ b/src/testing/test_exchange_api_keys_cherry_picking-cs.conf @@ -0,0 +1,98 @@ +# This file is in the public domain. +# +[PATHS] +# Persistent data storage for the testcase +TALER_TEST_HOME = test_exchange_api_keys_cherry_picking_home/ +TALER_RUNTIME_DIR = ${TMPDIR:-${TMP:-/tmp}}/${USER:-}/taler-system-runtime/ + +# Persistent data storage +TALER_DATA_HOME = $TALER_HOME/.local/share/taler/ + +# Configuration files +TALER_CONFIG_HOME = $TALER_HOME/.config/taler/ + +# Cached data, no big deal if lost +TALER_CACHE_HOME = $TALER_HOME/.cache/taler/ + +[taler] +# Currency supported by the exchange (can only be one) +CURRENCY = EUR + +[taler-exchange-secmod-cs] +# Reduce from 1 year to speed up test +LOOKAHEAD_SIGN = 24 days + +[taler-exchange-secmod-eddsa] +# Reduce from 1 year to speed up test +LOOKAHEAD_SIGN = 24 days +# Reduce from 12 weeks to ensure we have multiple +DURATION = 14 days + +[auditor] +BASE_URL = "http://localhost:8083/" + +# HTTP port the auditor listens to +PORT = 8083 + +[exchange] +# HTTP port the exchange listens to +PORT = 8081 + +# Master public key used to sign the exchange's various keys +MASTER_PUBLIC_KEY = 98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG + +# How to access our database +DB = postgres + +# Base URL of the exchange. Must be set to a URL where the +# exchange (or the twister) is actually listening. +BASE_URL = "http://localhost:8081/" + + +[exchangedb-postgres] +CONFIG = "postgres:///talercheck" + +[auditordb-postgres] +CONFIG = "postgres:///talercheck" + +[exchange-account-1] +PAYTO_URI = payto://x-taler-bank/localhost/42 + +[exchange-accountcredentials-1] +WIRE_GATEWAY_URL = "http://localhost:9082/42/" + +[exchange-account-2] +PAYTO_URI = payto://x-taler-bank/localhost/2 +ENABLE_DEBIT = YES +ENABLE_CREDIT = YES + +[exchange-accountcredentials-2] +WIRE_GATEWAY_URL = "http://localhost:9082/2/" + +# Authentication information for basic authentication +TALER_BANK_AUTH_METHOD = "basic" +USERNAME = user +PASSWORD = pass + +[bank] +HTTP_PORT=8082 + +[taler-exchange-secmod-cs] +OVERLAP_DURATION = 1 s +LOOKAHEAD_SIGN = 20 s + +[taler-exchange-secmod-eddsa] +OVERLAP_DURATION = 1 s +DURATION = 30 s +LOOKAHEAD_SIGN = 20 s + +[coin_eur_1] +value = EUR:1 +duration_withdraw = 5 s +duration_spend = 6 s +duration_legal = 7 s +fee_withdraw = EUR:0.01 +fee_deposit = EUR:0.01 +fee_refresh = EUR:0.03 +fee_refund = EUR:0.01 +CIPHER = CS diff --git a/src/testing/test_exchange_api_keys_cherry_picking.c b/src/testing/test_exchange_api_keys_cherry_picking.c index 6ab17c63..2a7dea14 100644 --- a/src/testing/test_exchange_api_keys_cherry_picking.c +++ b/src/testing/test_exchange_api_keys_cherry_picking.c @@ -39,7 +39,7 @@ lished   * Configuration file we use.  One (big) configuration is used   * for the various components for this test.   */ -#define CONFIG_FILE "test_exchange_api_keys_cherry_picking.conf" +static char *config_file;  /**   * Exchange configuration data. @@ -66,11 +66,11 @@ run (void *cls,                                  MHD_HTTP_NO_CONTENT,                                  false),      TALER_TESTING_cmd_exec_offline_sign_fees ("offline-sign-fees", -                                              CONFIG_FILE, +                                              config_file,                                                "EUR:0.01",                                                "EUR:0.01"),      TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys", -                                              CONFIG_FILE), +                                              config_file),      TALER_TESTING_cmd_check_keys_pull_all_keys ("initial-/keys",                                                  1),      TALER_TESTING_cmd_sleep ("sleep", @@ -109,19 +109,25 @@ int  main (int argc,        char *const *argv)  { +  const char *cipher; +    (void) argc; -  (void) argv;    /* These environment variables get in the way... */    unsetenv ("XDG_DATA_HOME");    unsetenv ("XDG_CONFIG_HOME"); -  GNUNET_log_setup ("test-exchange-api-cherry-picking", +  GNUNET_log_setup (argv[0],                      "DEBUG",                      NULL); -  TALER_TESTING_cleanup_files (CONFIG_FILE); +  cipher = GNUNET_TESTING_get_testname_from_underscore (argv[0]); +  GNUNET_assert (NULL != cipher); +  GNUNET_asprintf (&config_file, +                   "test_exchange_api_keys_cherry_picking-%s.conf", +                   cipher); +  TALER_TESTING_cleanup_files (config_file);    /* @helpers.  Run keyup, create tables, ... Note: it     * fetches the port number from config in order to see     * if it's available. */ -  switch (TALER_TESTING_prepare_exchange (CONFIG_FILE, +  switch (TALER_TESTING_prepare_exchange (config_file,                                            GNUNET_YES,                                            &ec))    { @@ -138,7 +144,7 @@ main (int argc,           */          TALER_TESTING_setup_with_exchange (&run,                                             NULL, -                                           CONFIG_FILE)) +                                           config_file))        return 1;      break;    default: diff --git a/src/testing/test_exchange_api_keys_cherry_picking.conf b/src/testing/test_exchange_api_keys_cherry_picking.conf index f4edaf42..e616738f 100644 --- a/src/testing/test_exchange_api_keys_cherry_picking.conf +++ b/src/testing/test_exchange_api_keys_cherry_picking.conf @@ -22,10 +22,6 @@ CURRENCY = EUR  # Reduce from 1 year to speed up test  LOOKAHEAD_SIGN = 24 days -[taler-exchange-secmod-cs] -# Reduce from 1 year to speed up test -LOOKAHEAD_SIGN = 24 days -  [taler-exchange-secmod-eddsa]  # Reduce from 1 year to speed up test  LOOKAHEAD_SIGN = 24 days @@ -85,10 +81,6 @@ HTTP_PORT=8082  OVERLAP_DURATION = 1 s  LOOKAHEAD_SIGN = 20 s -[taler-exchange-secmod-cs] -OVERLAP_DURATION = 1 s -LOOKAHEAD_SIGN = 20 s -  [taler-exchange-secmod-eddsa]  OVERLAP_DURATION = 1 s  DURATION = 30 s @@ -105,14 +97,3 @@ fee_refresh = EUR:0.03  fee_refund = EUR:0.01  CIPHER = RSA  rsa_keysize = 1024 - -[coin_eur_2] -value = EUR:1 -duration_withdraw = 5 s -duration_spend = 6 s -duration_legal = 7 s -fee_withdraw = EUR:0.01 -fee_deposit = EUR:0.01 -fee_refresh = EUR:0.03 -fee_refund = EUR:0.01 -CIPHER = CS diff --git a/src/testing/test_exchange_api_revocation.c b/src/testing/test_exchange_api_revocation.c index 0531c5b8..40bc4d53 100644 --- a/src/testing/test_exchange_api_revocation.c +++ b/src/testing/test_exchange_api_revocation.c @@ -38,7 +38,7 @@   * Configuration file we use.  One (big) configuration is used   * for the various components for this test.   */ -#define CONFIG_FILE "test_exchange_api.conf" +static char *config_file;  /**   * Exchange configuration data. @@ -70,7 +70,7 @@ run (void *cls,                                  MHD_HTTP_NO_CONTENT,                                  false),      TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys", -                                              CONFIG_FILE), +                                              config_file),      TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys",                                                  1),      /** @@ -90,7 +90,7 @@ run (void *cls,       * Run wire-watch to trigger the reserve creation.       */      TALER_TESTING_cmd_exec_wirewatch ("wirewatch-4", -                                      CONFIG_FILE), +                                      config_file),      /* Withdraw a 5 EUR coin, at fee of 1 ct */      TALER_TESTING_cmd_withdraw_amount ("withdraw-revocation-coin-1",                                         "create-reserve-1", @@ -144,12 +144,12 @@ run (void *cls,      TALER_TESTING_cmd_revoke ("revoke-2-EUR:5",                                MHD_HTTP_OK,                                "refresh-melt-1", -                              CONFIG_FILE), +                              config_file),      /* Also make fully spent coin invalid (should be same denom) */      TALER_TESTING_cmd_revoke ("revoke-2-EUR:5",                                MHD_HTTP_OK,                                "withdraw-revocation-coin-2", -                              CONFIG_FILE), +                              config_file),      /* Refund fully spent coin (which should fail) */      TALER_TESTING_cmd_recoup ("recoup-fully-spent",                                MHD_HTTP_CONFLICT, @@ -211,12 +211,12 @@ run (void *cls,      TALER_TESTING_cmd_revoke ("revoke-3-EUR:0.1",                                MHD_HTTP_OK,                                "refresh-reveal-2", -                              CONFIG_FILE), +                              config_file),      /* Revoke also original coin denomination */      TALER_TESTING_cmd_revoke ("revoke-4-EUR:5",                                MHD_HTTP_OK,                                "withdraw-revocation-coin-1", -                              CONFIG_FILE), +                              config_file),      /* Refund coin EUR:0.1 to original coin, creating zombie! */      TALER_TESTING_cmd_recoup_refresh ("recoup-2",                                        MHD_HTTP_OK, @@ -248,25 +248,31 @@ int  main (int argc,        char *const *argv)  { +  const char *cipher; +    (void) argc; -  (void) argv;    /* These environment variables get in the way... */    unsetenv ("XDG_DATA_HOME");    unsetenv ("XDG_CONFIG_HOME"); -  GNUNET_log_setup ("test-exchange-api-revocation", +  GNUNET_log_setup (argv[0],                      "INFO",                      NULL); +  cipher = GNUNET_TESTING_get_testname_from_underscore (argv[0]); +  GNUNET_assert (NULL != cipher); +  GNUNET_asprintf (&config_file, +                   "test_exchange_api-%s.conf", +                   cipher);    /* Check fakebank port is available and get config */    if (GNUNET_OK != -      TALER_TESTING_prepare_fakebank (CONFIG_FILE, +      TALER_TESTING_prepare_fakebank (config_file,                                        "exchange-account-2",                                        &bc))      return 77; -  TALER_TESTING_cleanup_files (CONFIG_FILE); +  TALER_TESTING_cleanup_files (config_file);    /* @helpers.  Run keyup, create tables, ... Note: it     * fetches the port number from config in order to see     * if it's available. */ -  switch (TALER_TESTING_prepare_exchange (CONFIG_FILE, +  switch (TALER_TESTING_prepare_exchange (config_file,                                            GNUNET_YES,                                            &ec))    { @@ -283,7 +289,7 @@ main (int argc,           */          TALER_TESTING_setup_with_exchange (&run,                                             NULL, -                                           CONFIG_FILE)) +                                           config_file))        return 1;      break;    default: diff --git a/src/testing/test_exchange_api_twisted.c b/src/testing/test_exchange_api_twisted.c index 02471eb9..2f4ba3a2 100644 --- a/src/testing/test_exchange_api_twisted.c +++ b/src/testing/test_exchange_api_twisted.c @@ -40,7 +40,7 @@   * Configuration file we use.  One (big) configuration is used   * for the various components for this test.   */ -#define CONFIG_FILE "test_exchange_api_twisted.conf" +static char *config_file;  /**   * (real) Twister URL.  Used at startup time to check if it runs. @@ -73,7 +73,7 @@ static struct TALER_TESTING_Command  CMD_EXEC_WIREWATCH (const char *label)  {    return TALER_TESTING_cmd_exec_wirewatch (label, -                                           CONFIG_FILE); +                                           config_file);  } @@ -142,7 +142,7 @@ run (void *cls,                              NULL),      /* Trigger 409 Conflict.  */      TALER_TESTING_cmd_flip_upload ("flip-upload", -                                   CONFIG_FILE, +                                   config_file,                                     "transfer_privs.0"),      TALER_TESTING_cmd_refresh_reveal ("refresh-(flipped-)reveal",                                        "refresh-melt", @@ -178,7 +178,7 @@ run (void *cls,                                "USD:5",                                "deposit-refund-1"),      TALER_TESTING_cmd_flip_upload ("flip-upload", -                                   CONFIG_FILE, +                                   config_file,                                     "merchant_sig"),      TALER_TESTING_cmd_refund ("refund-bad-sig",                                MHD_HTTP_FORBIDDEN, @@ -217,7 +217,7 @@ run (void *cls,     */    struct TALER_TESTING_Command expired_keys[] = {      TALER_TESTING_cmd_modify_header_dl ("modify-expiration", -                                        CONFIG_FILE, +                                        config_file,                                          MHD_HTTP_HEADER_EXPIRES,                                          "Wed, 19 Jan 586524 08:01:49 GMT"),      TALER_TESTING_cmd_check_keys_pull_all_keys ( @@ -243,7 +243,7 @@ run (void *cls,                                  MHD_HTTP_NO_CONTENT,                                  false),      TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys", -                                              CONFIG_FILE), +                                              config_file),      TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys",                                                  1),      TALER_TESTING_cmd_batch ("refresh-reveal-409-conflict", @@ -283,26 +283,31 @@ int  main (int argc,        char *const *argv)  { +  const char *cipher;    int ret;    (void) argc; -  (void) argv;    /* These environment variables get in the way... */    unsetenv ("XDG_DATA_HOME");    unsetenv ("XDG_CONFIG_HOME"); -  GNUNET_log_setup ("test-exchange-api-twisted", +  GNUNET_log_setup (argv[0],                      "DEBUG",                      NULL); +  cipher = GNUNET_TESTING_get_testname_from_underscore (argv[0]); +  GNUNET_assert (NULL != cipher); +  GNUNET_asprintf (&config_file, +                   "test_exchange_api_twisted-%s.conf", +                   cipher);    if (GNUNET_OK != -      TALER_TESTING_prepare_fakebank (CONFIG_FILE, +      TALER_TESTING_prepare_fakebank (config_file,                                        "exchange-account-2",                                        &bc))      return 77;    if (NULL == (twister_url = TALER_TWISTER_prepare_twister -                               (CONFIG_FILE))) +                               (config_file)))      return 77; -  TALER_TESTING_cleanup_files (CONFIG_FILE); -  switch (TALER_TESTING_prepare_exchange (CONFIG_FILE, +  TALER_TESTING_cleanup_files (config_file); +  switch (TALER_TESTING_prepare_exchange (config_file,                                            GNUNET_YES,                                            &ec))    { @@ -312,11 +317,11 @@ main (int argc,    case GNUNET_NO:      return 77;    case GNUNET_OK: -    if (NULL == (twisterd = TALER_TWISTER_run_twister (CONFIG_FILE))) +    if (NULL == (twisterd = TALER_TWISTER_run_twister (config_file)))        return 77;      ret = TALER_TESTING_setup_with_exchange (&run,                                               NULL, -                                             CONFIG_FILE); +                                             config_file);      purge_process (twisterd);      GNUNET_free (twister_url); diff --git a/src/testing/testing_api_cmd_refresh.c b/src/testing/testing_api_cmd_refresh.c index 0b47f508..9f49b354 100644 --- a/src/testing/testing_api_cmd_refresh.c +++ b/src/testing/testing_api_cmd_refresh.c @@ -1049,9 +1049,7 @@ melt_run (void *cls,          return;        }        fresh_pk = TALER_TESTING_find_pk (TALER_EXCHANGE_get_keys (is->exchange), -                                        &fresh_amount, -                                        // FIXME: replace hardcoded value -                                        TALER_DENOMINATION_RSA); +                                        &fresh_amount);        if (NULL == fresh_pk)        {          GNUNET_break (0); diff --git a/src/testing/testing_api_cmd_withdraw.c b/src/testing/testing_api_cmd_withdraw.c index da514ddf..7e2eecce 100644 --- a/src/testing/testing_api_cmd_withdraw.c +++ b/src/testing/testing_api_cmd_withdraw.c @@ -73,11 +73,6 @@ struct WithdrawState    struct TALER_Amount amount;    /** -   * Type of denomination that we should withdraw -   */ -  enum TALER_DenominationCipher cipher; - -  /**     * If @e amount is NULL, this specifies the denomination key to     * use.  Otherwise, this will be set (by the interpreter) to the     * denomination PK matching @e amount. @@ -121,11 +116,6 @@ struct WithdrawState    struct TALER_PlanchetSecretsP ps;    /** -   * Withdraw Values used for planchet creation -   */ -  struct TALER_ExchangeWithdrawValues alg_values; - -  /**     * Reserve history entry that corresponds to this operation.     * Will be of type #TALER_EXCHANGE_RTT_WITHDRAWAL.     */ @@ -396,10 +386,9 @@ withdraw_run (void *cls,    ws->reserve_payto_uri      = TALER_payto_from_reserve (ws->exchange_url,                                  &ws->reserve_pub); -  ws->alg_values.cipher = ws->cipher;    if (NULL == ws->reuse_coin_key_ref)    { -    TALER_planchet_setup_random (&ws->ps, &ws->alg_values); +    TALER_planchet_setup_coin_priv (&ws->ps.coin_priv);    }    else    { @@ -420,14 +409,13 @@ withdraw_run (void *cls,                     TALER_TESTING_get_trait_coin_priv (cref,                                                        index,                                                        &coin_priv)); -    TALER_planchet_setup_random (&ws->ps, &ws->alg_values); +    TALER_planchet_setup_coin_priv (&ws->ps.coin_priv);      ws->ps.coin_priv = *coin_priv;    }    if (NULL == ws->pk)    {      dpk = TALER_TESTING_find_pk (TALER_EXCHANGE_get_keys (is->exchange), -                                 &ws->amount, -                                 ws->cipher); +                                 &ws->amount);      if (NULL == dpk)      {        GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -455,7 +443,6 @@ withdraw_run (void *cls,                                       ws->pk,                                       rp,                                       &ws->ps, -                                     &ws->alg_values,                                       &reserve_withdraw_cb,                                       ws);    if (NULL == ws->wsh) @@ -570,8 +557,6 @@ TALER_TESTING_cmd_withdraw_amount (const char *label,                                     const char *amount,                                     unsigned int expected_response_code)  { -  // TODO: ATM this is hardcoded to RSA denominations -  // (use TALER_TESTING_cmd_withdraw_cs_amount for Clause Schnorr)    struct WithdrawState *ws;    ws = GNUNET_new (struct WithdrawState); @@ -587,43 +572,6 @@ TALER_TESTING_cmd_withdraw_amount (const char *label,      GNUNET_assert (0);    }    ws->expected_response_code = expected_response_code; -  ws->cipher = TALER_DENOMINATION_RSA; -  { -    struct TALER_TESTING_Command cmd = { -      .cls = ws, -      .label = label, -      .run = &withdraw_run, -      .cleanup = &withdraw_cleanup, -      .traits = &withdraw_traits -    }; - -    return cmd; -  } -} - - -struct TALER_TESTING_Command -TALER_TESTING_cmd_withdraw_cs_amount (const char *label, -                                      const char *reserve_reference, -                                      const char *amount, -                                      unsigned int expected_response_code) -{ -  struct WithdrawState *ws; - -  ws = GNUNET_new (struct WithdrawState); -  ws->reserve_reference = reserve_reference; -  if (GNUNET_OK != -      TALER_string_to_amount (amount, -                              &ws->amount)) -  { -    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, -                "Failed to parse amount `%s' at %s\n", -                amount, -                label); -    GNUNET_assert (0); -  } -  ws->expected_response_code = expected_response_code; -  ws->cipher = TALER_DENOMINATION_CS;    {      struct TALER_TESTING_Command cmd = {        .cls = ws, @@ -661,8 +609,6 @@ TALER_TESTING_cmd_withdraw_amount_reuse_key (    const char *coin_ref,    unsigned int expected_response_code)  { -  // TODO: ATM this is hardcoded to RSA denominations -  // (use TALER_TESTING_cmd_withdraw_cs_amount for Clause Schnorr)    struct TALER_TESTING_Command cmd;    cmd = TALER_TESTING_cmd_withdraw_amount (label, @@ -678,29 +624,6 @@ TALER_TESTING_cmd_withdraw_amount_reuse_key (  } -struct TALER_TESTING_Command -TALER_TESTING_cmd_withdraw_cs_amount_reuse_key ( -  const char *label, -  const char *reserve_reference, -  const char *amount, -  const char *coin_ref, -  unsigned int expected_response_code) -{ -  struct TALER_TESTING_Command cmd; - -  cmd = TALER_TESTING_cmd_withdraw_cs_amount (label, -                                              reserve_reference, -                                              amount, -                                              expected_response_code); -  { -    struct WithdrawState *ws = cmd.cls; - -    ws->reuse_coin_key_ref = coin_ref; -  } -  return cmd; -} - -  /**   * Create withdraw command, letting the caller specify the   * amount by a denomination key. @@ -733,7 +656,6 @@ TALER_TESTING_cmd_withdraw_denomination (    ws->reserve_reference = reserve_reference;    ws->pk = TALER_EXCHANGE_copy_denomination_key (dk);    ws->expected_response_code = expected_response_code; -  ws->cipher = dk->key.cipher;    {      struct TALER_TESTING_Command cmd = {        .cls = ws, diff --git a/src/testing/testing_api_helpers_exchange.c b/src/testing/testing_api_helpers_exchange.c index a30db033..9414af66 100644 --- a/src/testing/testing_api_helpers_exchange.c +++ b/src/testing/testing_api_helpers_exchange.c @@ -411,18 +411,9 @@ TALER_TESTING_prepare_exchange (const char *config_filename,  } -/** - * Find denomination key matching the given amount. - * - * @param keys array of keys to search - * @param amount coin value to look for - * @param cipher denomination cipher - * @return NULL if no matching key was found - */  const struct TALER_EXCHANGE_DenomPublicKey *  TALER_TESTING_find_pk (const struct TALER_EXCHANGE_Keys *keys, -                       const struct TALER_Amount *amount, -                       const enum TALER_DenominationCipher cipher) +                       const struct TALER_Amount *amount)  {    struct GNUNET_TIME_Timestamp now;    struct TALER_EXCHANGE_DenomPublicKey *pk; @@ -432,8 +423,6 @@ TALER_TESTING_find_pk (const struct TALER_EXCHANGE_Keys *keys,    for (unsigned int i = 0; i<keys->num_denom_keys; i++)    {      pk = &keys->denom_keys[i]; -    if (cipher != pk->key.cipher) -      continue;      if ( (0 == TALER_amount_cmp (amount,                                   &pk->value)) &&           (GNUNET_TIME_timestamp_cmp (now, @@ -450,8 +439,6 @@ TALER_TESTING_find_pk (const struct TALER_EXCHANGE_Keys *keys,    for (unsigned int i = 0; i<keys->num_denom_keys; i++)    {      pk = &keys->denom_keys[i]; -    if (cipher != pk->key.cipher) -      continue;      if ( (0 == TALER_amount_cmp (amount,                                   &pk->value)) &&           (GNUNET_TIME_timestamp_cmp (now, @@ -473,25 +460,6 @@ TALER_TESTING_find_pk (const struct TALER_EXCHANGE_Keys *keys,        return NULL;      }    } -  // do 3rd pass to check if cipher type is to blame for failure -  for (unsigned int i = 0; i<keys->num_denom_keys; i++) -  { -    pk = &keys->denom_keys[i]; -    if ( (0 == TALER_amount_cmp (amount, -                                 &pk->value)) && -         (cipher != pk->key.cipher) ) -    { -      GNUNET_log -        (GNUNET_ERROR_TYPE_WARNING, -        "Have denomination key for `%s', but with wrong" -        " cipher type %d vs %d\n", -        str, -        cipher, -        pk->key.cipher); -      GNUNET_free (str); -      return NULL; -    } -  }    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,                "No denomination key for amount %s found\n",                str);  | 
