aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGian Demarmels <gian@demarmels.org>2022-02-04 19:50:40 +0100
committerGian Demarmels <gian@demarmels.org>2022-02-04 19:50:40 +0100
commit30c92a9b9e03289d274cce243b6c2a56cc8f5208 (patch)
tree7ef35f1137c35a20bf95447eeafaf00b780b0890
parent752c0aca43bb365e16af6e5f09b1e3707ac1b851 (diff)
parent03fd154a69212df740cf3b09567a1bb081b64873 (diff)
Merge branch 'master' of ssh://git.taler.net/exchange
m---------contrib/gana0
-rw-r--r--src/auditor/generate-auditor-basedb.conf66
-rw-r--r--src/benchmark/bank-benchmark-cs.conf128
-rw-r--r--src/benchmark/bank-benchmark-rsa.conf (renamed from src/benchmark/bank-benchmark.conf)55
-rw-r--r--src/benchmark/benchmark-cs.conf126
-rw-r--r--src/benchmark/benchmark-rsa.conf (renamed from src/benchmark/benchmark.conf)55
-rw-r--r--src/exchange/taler-exchange-httpd.c8
-rw-r--r--src/exchange/test_taler_exchange_httpd.conf38
-rw-r--r--src/exchange/test_taler_exchange_unix.conf40
-rw-r--r--src/include/taler_crypto_lib.h17
-rw-r--r--src/include/taler_exchange_service.h1
-rw-r--r--src/include/taler_testing_lib.h46
-rw-r--r--src/lib/exchange_api_withdraw.c20
-rw-r--r--src/testing/.gitignore9
-rw-r--r--src/testing/Makefile.am150
-rw-r--r--src/testing/test-taler-exchange-aggregator-postgres.conf11
-rw-r--r--src/testing/test-taler-exchange-wirewatch-postgres.conf11
-rw-r--r--src/testing/test_auditor_api-cs.conf140
-rw-r--r--src/testing/test_auditor_api-rsa.conf145
-rw-r--r--src/testing/test_auditor_api.c50
-rw-r--r--src/testing/test_exchange_api-cs.conf (renamed from src/testing/test_auditor_api.conf)105
-rw-r--r--src/testing/test_exchange_api.c196
-rw-r--r--src/testing/test_exchange_api.conf45
-rw-r--r--src/testing/test_exchange_api_keys_cherry_picking-cs.conf98
-rw-r--r--src/testing/test_exchange_api_keys_cherry_picking.c22
-rw-r--r--src/testing/test_exchange_api_keys_cherry_picking.conf19
-rw-r--r--src/testing/test_exchange_api_revocation.c32
-rw-r--r--src/testing/test_exchange_api_twisted.c33
-rw-r--r--src/testing/testing_api_cmd_refresh.c4
-rw-r--r--src/testing/testing_api_cmd_withdraw.c84
-rw-r--r--src/testing/testing_api_helpers_exchange.c34
-rw-r--r--src/util/crypto.c24
32 files changed, 1009 insertions, 803 deletions
diff --git a/contrib/gana b/contrib/gana
-Subproject 6b74d0faa173bbb220cdd82dcf3915dadd241e1
+Subproject 3a71278a2aab67f9a1888af172b507d6e08364c
diff --git a/src/auditor/generate-auditor-basedb.conf b/src/auditor/generate-auditor-basedb.conf
index 205a04a26..5540aa3b8 100644
--- a/src/auditor/generate-auditor-basedb.conf
+++ b/src/auditor/generate-auditor-basedb.conf
@@ -217,72 +217,6 @@ fee_refund = TESTKUDOS:0.01
CIPHER = RSA
rsa_keysize = 1024
-[coin_kudos_12]
-value = TESTKUDOS:1
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = TESTKUDOS:0.02
-fee_deposit = TESTKUDOS:0.02
-fee_refresh = TESTKUDOS:0.03
-fee_refund = TESTKUDOS:0.01
-CIPHER = CS
-
-[coin_kudos_21]
-value = TESTKUDOS:2
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = TESTKUDOS:0.03
-fee_deposit = TESTKUDOS:0.03
-fee_refresh = TESTKUDOS:0.04
-fee_refund = TESTKUDOS:0.02
-CIPHER = CS
-
-[coin_kudos_41]
-value = TESTKUDOS:4
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = TESTKUDOS:0.03
-fee_deposit = TESTKUDOS:0.03
-fee_refresh = TESTKUDOS:0.04
-fee_refund = TESTKUDOS:0.02
-CIPHER = CS
-
-[coin_kudos_51]
-value = TESTKUDOS:5
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = TESTKUDOS:0.01
-fee_deposit = TESTKUDOS:0.01
-fee_refresh = TESTKUDOS:0.03
-fee_refund = TESTKUDOS:0.01
-CIPHER = CS
-
-[coin_kudos_81]
-value = TESTKUDOS:8
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = TESTKUDOS:0.05
-fee_deposit = TESTKUDOS:0.02
-fee_refresh = TESTKUDOS:0.03
-fee_refund = TESTKUDOS:0.04
-CIPHER = CS
-
-[coin_kudos_111]
-value = TESTKUDOS:10
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = TESTKUDOS:0.01
-fee_deposit = TESTKUDOS:0.01
-fee_refresh = TESTKUDOS:0.03
-fee_refund = TESTKUDOS:0.01
-CIPHER = CS
-
[benchmark]
BANK_DETAILS = bank_details.json
MERCHANT_DETAILS = merchant_details.json
diff --git a/src/benchmark/bank-benchmark-cs.conf b/src/benchmark/bank-benchmark-cs.conf
new file mode 100644
index 000000000..d012f0faa
--- /dev/null
+++ b/src/benchmark/bank-benchmark-cs.conf
@@ -0,0 +1,128 @@
+# This file is in the public domain.
+#
+[paths]
+# Persistent data storage for the testcase
+# This value is a default for `taler_config_home'
+taler_test_home = exchange_benchmark_home/
+
+[taler]
+# Currency supported by the exchange (can only be one)
+currency = EUR
+CURRENCY_ROUND_UNIT = EUR:0.01
+
+[exchange]
+# how long is one signkey valid?
+signkey_duration = 4 weeks
+signkey_legal_duration = 2 years
+# how long do we provide to clients denomination and signing keys
+# ahead of time?
+# Keep it short so the test runs fast.
+lookahead_sign = 12h
+# 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/"
+
+WIREWATCH_IDLE_SLEEP_INTERVAL = 1500 ms
+
+[exchange-offline]
+MASTER_PRIV_FILE = ${TALER_DATA_HOME}/exchange/offline-keys/master.priv
+
+[auditor]
+BASE_URL = "http://localhost:8083/"
+
+[exchangedb-postgres]
+config = "postgres:///talercheck"
+
+[benchmark-remote-exchange]
+host = localhost
+# Adjust $HOME to match remote target!
+dir = $HOME/repos/taler/exchange/src/benchmark
+
+[bank]
+HTTP_PORT = 8082
+SERVE = http
+MAX_DEBT = EUR:100000000000.0
+MAX_DEBT_BANK = EUR:1000000000000000.0
+
+[benchmark]
+USER_PAYTO_URI = payto://x-taler-bank/localhost:8082/42
+
+[exchange-account-2]
+# What is the payto://-URL of the exchange (to generate wire response)
+PAYTO_URI = "payto://x-taler-bank/localhost:8082/Exchange"
+enable_debit = YES
+enable_credit = YES
+
+[exchange-accountcredentials-2]
+# What is the bank account (with the "Taler Bank" demo system)? Must end with "/".
+WIRE_GATEWAY_URL = http://localhost:8082/Exchange/
+# Authentication information for basic authentication
+WIRE_GATEWAY_AUTH_METHOD = "basic"
+username = Exchange
+password = x
+
+
+
+
+# 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/benchmark/bank-benchmark.conf b/src/benchmark/bank-benchmark-rsa.conf
index c98b1374e..f2f4dee50 100644
--- a/src/benchmark/bank-benchmark.conf
+++ b/src/benchmark/bank-benchmark-rsa.conf
@@ -131,58 +131,3 @@ fee_refresh = EUR:0.03
fee_refund = EUR:0.01
CIPHER = RSA
rsa_keysize = 2048
-
-[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_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_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_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 = RSA
-
-[coin_eur_11]
-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/benchmark/benchmark-cs.conf b/src/benchmark/benchmark-cs.conf
new file mode 100644
index 000000000..d0d14b8d9
--- /dev/null
+++ b/src/benchmark/benchmark-cs.conf
@@ -0,0 +1,126 @@
+# This file is in the public domain.
+#
+[paths]
+# Persistent data storage for the testcase
+# This value is a default for `taler_config_home'
+TALER_TEST_HOME = exchange_benchmark_home/
+
+[taler]
+# Currency supported by the exchange (can only be one)
+CURRENCY = EUR
+CURRENCY_ROUND_UNIT = EUR:0.01
+
+[exchange]
+
+SIGNKEY_LEGAL_DURATION = 2 years
+
+# 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/"
+
+AGGREGATOR_SHARD_SIZE = 67108864
+#AGGREGATOR_SHARD_SIZE = 2147483648
+
+
+
+WIREWATCH_IDLE_SLEEP_INTERVAL = 5 ms
+
+[exchange-offline]
+MASTER_PRIV_FILE = ${TALER_DATA_HOME}/exchange/offline-keys/master.priv
+
+[auditor]
+BASE_URL = "http://localhost:8083/"
+
+[exchangedb-postgres]
+CONFIG = "postgres:///talercheck"
+
+[benchmark-remote-exchange]
+HOST = localhost
+# Adjust $HOME to match remote target!
+DIR = $HOME/repos/taler/exchange/src/benchmark
+
+[bank]
+HTTP_PORT = 8082
+SERVE = http
+MAX_DEBT = EUR:100000000000.0
+MAX_DEBT_BANK = EUR:1000000000000000.0
+
+[benchmark]
+USER_PAYTO_URI = payto://x-taler-bank/localhost:8082/42
+
+[exchange-account-test]
+# What is the bank account (with the "Taler Bank" demo system)? Must end with "/".
+PAYTO_URI = "payto://x-taler-bank/localhost/Exchange"
+# Authentication information for basic authentication
+ENABLE_DEBIT = YES
+ENABLE_CREDIT = YES
+
+[exchange-accountcredentials-test]
+WIRE_GATEWAY_URL = http://localhost:8082/Exchange/
+WIRE_GATEWAY_AUTH_METHOD = "basic"
+USERNAME = Exchange
+PASSWORD = x
+
+
+# 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/benchmark/benchmark.conf b/src/benchmark/benchmark-rsa.conf
index 375665a05..7b5b0d1f1 100644
--- a/src/benchmark/benchmark.conf
+++ b/src/benchmark/benchmark-rsa.conf
@@ -129,58 +129,3 @@ fee_refresh = EUR:0.03
fee_refund = EUR:0.01
CIPHER = RSA
rsa_keysize = 2048
-
-[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_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_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_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 = RSA
-
-[coin_eur_11]
-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 \ No newline at end of file
diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c
index c357813b2..5150b32c2 100644
--- a/src/exchange/taler-exchange-httpd.c
+++ b/src/exchange/taler-exchange-httpd.c
@@ -517,8 +517,8 @@ proceed_with_handler (struct TEH_RequestContext *rc,
sizeof (emsg),
"Got %u/%u segments for %s request ('%s')",
(NULL == args[i - 1])
- ? i - 1
- : i + ((NULL != fin) ? 1 : 0),
+ ? i - 1
+ : i + ((NULL != fin) ? 1 : 0),
rh->nargs,
rh->url,
url);
@@ -1950,8 +1950,8 @@ run (void *cls,
MHD_OPTION_CONNECTION_TIMEOUT,
connection_timeout,
(0 == allow_address_reuse)
- ? MHD_OPTION_END
- : MHD_OPTION_LISTENING_ADDRESS_REUSE,
+ ? MHD_OPTION_END
+ : MHD_OPTION_LISTENING_ADDRESS_REUSE,
(unsigned int) allow_address_reuse,
MHD_OPTION_END);
if (NULL == mhd)
diff --git a/src/exchange/test_taler_exchange_httpd.conf b/src/exchange/test_taler_exchange_httpd.conf
index 25938679b..9bd4851fb 100644
--- a/src/exchange/test_taler_exchange_httpd.conf
+++ b/src/exchange/test_taler_exchange_httpd.conf
@@ -70,7 +70,7 @@ PASSWORD = x
WIRE_GATEWAY_URL = "http://localhost:8082/3/"
# Coins for the tests.
-[coin_eur_ct_1]
+[coin_eur_ct_1_rsa]
value = EUR:0.01
duration_withdraw = 7 days
duration_spend = 2 years
@@ -82,20 +82,19 @@ fee_refund = EUR:0.01
CIPHER = RSA
rsa_keysize = 1024
-[coin_eur_ct_10]
-value = EUR:0.10
+[coin_eur_ct_1_cs]
+value = EUR:0.01
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_withdraw = EUR:0.00
+fee_deposit = EUR:0.00
+fee_refresh = EUR:0.01
fee_refund = EUR:0.01
-CIPHER = RSA
-rsa_keysize = 1024
+CIPHER = CS
-[coin_eur_1]
-value = EUR:1
+[coin_eur_ct_10_rsa]
+value = EUR:0.10
duration_withdraw = 7 days
duration_spend = 2 years
duration_legal = 3 years
@@ -106,19 +105,19 @@ fee_refund = EUR:0.01
CIPHER = RSA
rsa_keysize = 1024
-[coin_eur_ct_2]
-value = EUR:0.01
+[coin_eur_ct_10_cs]
+value = EUR:0.10
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_withdraw = EUR:0.01
+fee_deposit = EUR:0.01
+fee_refresh = EUR:0.03
fee_refund = EUR:0.01
CIPHER = CS
-[coin_eur_ct_11]
-value = EUR:0.10
+[coin_eur_1_rsa]
+value = EUR:1
duration_withdraw = 7 days
duration_spend = 2 years
duration_legal = 3 years
@@ -126,9 +125,10 @@ fee_withdraw = EUR:0.01
fee_deposit = EUR:0.01
fee_refresh = EUR:0.03
fee_refund = EUR:0.01
-CIPHER = CS
+CIPHER = RSA
+rsa_keysize = 1024
-[coin_eur_2]
+[coin_eur_1_cs]
value = EUR:1
duration_withdraw = 7 days
duration_spend = 2 years
diff --git a/src/exchange/test_taler_exchange_unix.conf b/src/exchange/test_taler_exchange_unix.conf
index 24e1a0fa4..e96bfba3f 100644
--- a/src/exchange/test_taler_exchange_unix.conf
+++ b/src/exchange/test_taler_exchange_unix.conf
@@ -70,7 +70,7 @@ TALER_BANK_AUTH_METHOD = NONE
# Coins for the tests.
-[coin_eur_ct_1]
+[coin_eur_ct_1_rsa]
value = EUR:0.01
duration_withdraw = 7 days
duration_spend = 2 years
@@ -82,20 +82,19 @@ fee_refund = EUR:0.01
CIPHER = RSA
rsa_keysize = 1024
-[coin_eur_ct_10]
-value = EUR:0.10
+[coin_eur_ct_1_cs]
+value = EUR:0.01
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_withdraw = EUR:0.00
+fee_deposit = EUR:0.00
+fee_refresh = EUR:0.01
fee_refund = EUR:0.01
-CIPHER = RSA
-rsa_keysize = 1024
+CIPHER = CS
-[coin_eur_1]
-value = EUR:1
+[coin_eur_ct_10_rsa]
+value = EUR:0.10
duration_withdraw = 7 days
duration_spend = 2 years
duration_legal = 3 years
@@ -106,19 +105,19 @@ fee_refund = EUR:0.01
CIPHER = RSA
rsa_keysize = 1024
-[coin_eur_ct_2]
-value = EUR:0.01
+[coin_eur_ct_10_cs]
+value = EUR:0.10
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_withdraw = EUR:0.01
+fee_deposit = EUR:0.01
+fee_refresh = EUR:0.03
fee_refund = EUR:0.01
CIPHER = CS
-[coin_eur_ct_11]
-value = EUR:0.10
+[coin_eur_1_rsa]
+value = EUR:1
duration_withdraw = 7 days
duration_spend = 2 years
duration_legal = 3 years
@@ -126,9 +125,10 @@ fee_withdraw = EUR:0.01
fee_deposit = EUR:0.01
fee_refresh = EUR:0.03
fee_refund = EUR:0.01
-CIPHER = CS
+CIPHER = RSA
+rsa_keysize = 1024
-[coin_eur_2]
+[coin_eur_1_cs]
value = EUR:1
duration_withdraw = 7 days
duration_spend = 2 years
@@ -137,4 +137,4 @@ 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
+CIPHER = CS
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index d9565dd71..7b38b1f70 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -987,6 +987,17 @@ struct TALER_ExchangeWithdrawValues
void
TALER_denom_pub_free (struct TALER_DenominationPublicKey *denom_pub);
+
+/**
+ * Create private key for a Taler coin.
+ *
+ * @param[out] coin_priv private key to initialize
+ */
+void
+TALER_planchet_setup_coin_priv (
+ struct TALER_CoinSpendPrivateKeyP *coin_priv);
+
+
/**
* @brief Method to derive withdraw nonce
*
@@ -1472,9 +1483,9 @@ TALER_planchet_setup_refresh (const struct TALER_TransferSecretP *secret_seed,
* @oaram alg_values WitdrawValues containing cipher
*/
void
-TALER_planchet_setup_random (struct TALER_PlanchetSecretsP *ps,
- const struct
- TALER_ExchangeWithdrawValues *alg_values);
+TALER_planchet_setup_random (
+ struct TALER_PlanchetSecretsP *ps,
+ const struct TALER_ExchangeWithdrawValues *alg_values);
/**
* Create a blinding secret @a bs for @a cipher.
diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h
index 68c971868..beb337387 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -1461,7 +1461,6 @@ TALER_EXCHANGE_withdraw (
const struct TALER_EXCHANGE_DenomPublicKey *pk,
const struct TALER_ReservePrivateKeyP *reserve_priv,
struct TALER_PlanchetSecretsP *ps,
- struct TALER_ExchangeWithdrawValues *alg_values,
TALER_EXCHANGE_WithdrawCallback res_cb,
void *res_cb_cls);
diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h
index c6bebbeef..20e3145f0 100644
--- a/src/include/taler_testing_lib.h
+++ b/src/include/taler_testing_lib.h
@@ -66,13 +66,11 @@ TALER_TESTING_make_wire_details (const char *payto);
*
* @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);
/**
@@ -1291,24 +1289,6 @@ TALER_TESTING_cmd_withdraw_amount (const char *label,
/**
- * Create a withdraw command using a CS denomination, letting the caller specify
- * the desired amount as string.
- *
- * @param label command label.
- * @param reserve_reference command providing us with a reserve to withdraw from
- * @param amount how much we withdraw.
- * @param expected_response_code which HTTP response code
- * we expect from the exchange.
- * @return the withdraw command to be executed by the interpreter.
- */
-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);
-
-
-/**
* Create a withdraw command, letting the caller specify
* the desired amount as string and also re-using an existing
* coin private key in the process (violating the specification,
@@ -1333,30 +1313,6 @@ TALER_TESTING_cmd_withdraw_amount_reuse_key (
/**
- * Create a CS withdraw command, letting the caller specify
- * the desired amount as string and also re-using an existing
- * coin private key in the process (violating the specification,
- * which will result in an error when spending the coin!).
- *
- * @param label command label.
- * @param reserve_reference command providing us with a reserve to withdraw from
- * @param amount how much we withdraw.
- * @param coin_ref reference to (withdraw/reveal) command of a coin
- * from which we should re-use the private key
- * @param expected_response_code which HTTP response code
- * we expect from the exchange.
- * @return the withdraw command to be executed by the interpreter.
- */
-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);
-
-
-/**
* Create withdraw command, letting the caller specify the
* amount by a denomination key.
*
diff --git a/src/lib/exchange_api_withdraw.c b/src/lib/exchange_api_withdraw.c
index a5a886767..7b851b492 100644
--- a/src/lib/exchange_api_withdraw.c
+++ b/src/lib/exchange_api_withdraw.c
@@ -220,31 +220,12 @@ withdraw_cs_stage_two_callback (void *cls,
}
-/**
- * Withdraw a coin from the exchange using a /reserve/withdraw request. Note
- * that to ensure that no money is lost in case of hardware failures,
- * the caller must have committed (most of) the arguments to disk
- * before calling, and be ready to repeat the request with the same
- * arguments in case of failures.
- *
- * @param exchange the exchange handle; the exchange must be ready to operate
- * @param pk kind of coin to create
- * @param reserve_priv private key of the reserve to withdraw from
- * @param ps secrets of the planchet
- * caller must have committed this value to disk before the call (with @a pk)
- * @param res_cb the callback to call when the final result for this request is available
- * @param res_cb_cls closure for the above callback
- * @return handle for the operation on success, NULL on error, i.e.
- * if the inputs are invalid (i.e. denomination key not with this exchange).
- * In this case, the callback is not called.
- */
struct TALER_EXCHANGE_WithdrawHandle *
TALER_EXCHANGE_withdraw (
struct TALER_EXCHANGE_Handle *exchange,
const struct TALER_EXCHANGE_DenomPublicKey *pk,
const struct TALER_ReservePrivateKeyP *reserve_priv,
struct TALER_PlanchetSecretsP *ps,
- struct TALER_ExchangeWithdrawValues *alg_values,
TALER_EXCHANGE_WithdrawCallback res_cb,
void *res_cb_cls)
{
@@ -256,7 +237,6 @@ TALER_EXCHANGE_withdraw (
wh->cb_cls = res_cb_cls;
wh->reserve_priv = reserve_priv;
wh->ps = *ps;
- wh->alg_values = *alg_values,
wh->pk = *pk;
wh->csrh = NULL;
diff --git a/src/testing/.gitignore b/src/testing/.gitignore
index 61e3a4c06..700bda4cd 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 bc78217b3..712001750 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 965f05b03..dfa017d0d 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 60d973c16..fda1acd77 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 000000000..fbd84461d
--- /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 000000000..95eb47b38
--- /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 90675dd92..6f3b220b6 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 8e3cd28db..3fbf4c3c3 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 ac5dfdc00..d701e4af9 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 4f9f24f3c..cffe3b87a 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 000000000..8967d6c0a
--- /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 6ab17c634..2a7dea14d 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 f4edaf429..e616738f0 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 0531c5b83..40bc4d536 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 02471eb91..2f4ba3a22 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 0b47f5080..9f49b354a 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 da514ddfa..7e2eecce9 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 a30db0336..9414af662 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);
diff --git a/src/util/crypto.c b/src/util/crypto.c
index fee3f31ea..18f809e34 100644
--- a/src/util/crypto.c
+++ b/src/util/crypto.c
@@ -245,19 +245,23 @@ TALER_planchet_blinding_secret_create (struct TALER_PlanchetSecretsP *ps,
}
-/**
- * @brief setup a random planchet
- * In Case of RSA planchet, the bks gets set
- * In Case of Clause Schnorr this will be set in future
- */
void
-TALER_planchet_setup_random (struct TALER_PlanchetSecretsP *ps,
- const struct
- TALER_ExchangeWithdrawValues *alg_values)
+TALER_planchet_setup_coin_priv (
+ struct TALER_CoinSpendPrivateKeyP *coin_priv)
{
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_STRONG,
- &ps->coin_priv,
- sizeof (struct TALER_CoinSpendPrivateKeyP));
+ coin_priv,
+ sizeof (*coin_priv));
+ // FIXME-jeff/dold: Clamping?
+}
+
+
+void
+TALER_planchet_setup_random (
+ struct TALER_PlanchetSecretsP *ps,
+ const struct TALER_ExchangeWithdrawValues *alg_values)
+{
+ TALER_planchet_setup_coin_priv (&ps->coin_priv);
switch (alg_values->cipher)
{
case TALER_DENOMINATION_INVALID: