Merge branch 'master' of ssh://git.taler.net/exchange

This commit is contained in:
Gian Demarmels 2022-02-04 19:50:40 +01:00
commit 30c92a9b9e
No known key found for this signature in database
GPG Key ID: 030CEDDCCC92D778
32 changed files with 1053 additions and 847 deletions

@ -1 +1 @@
Subproject commit 6b74d0faa173bbb220cdd82dcf3915dadd241e1e Subproject commit 3a71278a2aab67f9a1888af172b507d6e08364cf

View File

@ -217,72 +217,6 @@ fee_refund = TESTKUDOS:0.01
CIPHER = RSA CIPHER = RSA
rsa_keysize = 1024 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] [benchmark]
BANK_DETAILS = bank_details.json BANK_DETAILS = bank_details.json
MERCHANT_DETAILS = merchant_details.json MERCHANT_DETAILS = merchant_details.json

View File

@ -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

View File

@ -131,58 +131,3 @@ fee_refresh = EUR:0.03
fee_refund = EUR:0.01 fee_refund = EUR:0.01
CIPHER = RSA CIPHER = RSA
rsa_keysize = 2048 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

View File

@ -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

View File

@ -129,58 +129,3 @@ fee_refresh = EUR:0.03
fee_refund = EUR:0.01 fee_refund = EUR:0.01
CIPHER = RSA CIPHER = RSA
rsa_keysize = 2048 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

View File

@ -517,8 +517,8 @@ proceed_with_handler (struct TEH_RequestContext *rc,
sizeof (emsg), sizeof (emsg),
"Got %u/%u segments for %s request ('%s')", "Got %u/%u segments for %s request ('%s')",
(NULL == args[i - 1]) (NULL == args[i - 1])
? i - 1 ? i - 1
: i + ((NULL != fin) ? 1 : 0), : i + ((NULL != fin) ? 1 : 0),
rh->nargs, rh->nargs,
rh->url, rh->url,
url); url);
@ -1950,8 +1950,8 @@ run (void *cls,
MHD_OPTION_CONNECTION_TIMEOUT, MHD_OPTION_CONNECTION_TIMEOUT,
connection_timeout, connection_timeout,
(0 == allow_address_reuse) (0 == allow_address_reuse)
? MHD_OPTION_END ? MHD_OPTION_END
: MHD_OPTION_LISTENING_ADDRESS_REUSE, : MHD_OPTION_LISTENING_ADDRESS_REUSE,
(unsigned int) allow_address_reuse, (unsigned int) allow_address_reuse,
MHD_OPTION_END); MHD_OPTION_END);
if (NULL == mhd) if (NULL == mhd)

View File

@ -70,7 +70,7 @@ PASSWORD = x
WIRE_GATEWAY_URL = "http://localhost:8082/3/" WIRE_GATEWAY_URL = "http://localhost:8082/3/"
# Coins for the tests. # Coins for the tests.
[coin_eur_ct_1] [coin_eur_ct_1_rsa]
value = EUR:0.01 value = EUR:0.01
duration_withdraw = 7 days duration_withdraw = 7 days
duration_spend = 2 years duration_spend = 2 years
@ -82,31 +82,7 @@ fee_refund = EUR:0.01
CIPHER = RSA CIPHER = RSA
rsa_keysize = 1024 rsa_keysize = 1024
[coin_eur_ct_10] [coin_eur_ct_1_cs]
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_ct_2]
value = EUR:0.01 value = EUR:0.01
duration_withdraw = 7 days duration_withdraw = 7 days
duration_spend = 2 years duration_spend = 2 years
@ -117,7 +93,19 @@ fee_refresh = EUR:0.01
fee_refund = EUR:0.01 fee_refund = EUR:0.01
CIPHER = CS CIPHER = CS
[coin_eur_ct_11] [coin_eur_ct_10_rsa]
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_ct_10_cs]
value = EUR:0.10 value = EUR:0.10
duration_withdraw = 7 days duration_withdraw = 7 days
duration_spend = 2 years duration_spend = 2 years
@ -128,7 +116,19 @@ fee_refresh = EUR:0.03
fee_refund = EUR:0.01 fee_refund = EUR:0.01
CIPHER = CS CIPHER = CS
[coin_eur_2] [coin_eur_1_rsa]
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_1_cs]
value = EUR:1 value = EUR:1
duration_withdraw = 7 days duration_withdraw = 7 days
duration_spend = 2 years duration_spend = 2 years

View File

@ -70,7 +70,7 @@ TALER_BANK_AUTH_METHOD = NONE
# Coins for the tests. # Coins for the tests.
[coin_eur_ct_1] [coin_eur_ct_1_rsa]
value = EUR:0.01 value = EUR:0.01
duration_withdraw = 7 days duration_withdraw = 7 days
duration_spend = 2 years duration_spend = 2 years
@ -82,31 +82,7 @@ fee_refund = EUR:0.01
CIPHER = RSA CIPHER = RSA
rsa_keysize = 1024 rsa_keysize = 1024
[coin_eur_ct_10] [coin_eur_ct_1_cs]
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_ct_2]
value = EUR:0.01 value = EUR:0.01
duration_withdraw = 7 days duration_withdraw = 7 days
duration_spend = 2 years duration_spend = 2 years
@ -117,7 +93,19 @@ fee_refresh = EUR:0.01
fee_refund = EUR:0.01 fee_refund = EUR:0.01
CIPHER = CS CIPHER = CS
[coin_eur_ct_11] [coin_eur_ct_10_rsa]
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_ct_10_cs]
value = EUR:0.10 value = EUR:0.10
duration_withdraw = 7 days duration_withdraw = 7 days
duration_spend = 2 years duration_spend = 2 years
@ -128,7 +116,19 @@ fee_refresh = EUR:0.03
fee_refund = EUR:0.01 fee_refund = EUR:0.01
CIPHER = CS CIPHER = CS
[coin_eur_2] [coin_eur_1_rsa]
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_1_cs]
value = EUR:1 value = EUR:1
duration_withdraw = 7 days duration_withdraw = 7 days
duration_spend = 2 years duration_spend = 2 years

View File

@ -987,6 +987,17 @@ struct TALER_ExchangeWithdrawValues
void void
TALER_denom_pub_free (struct TALER_DenominationPublicKey *denom_pub); 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 * @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 * @oaram alg_values WitdrawValues containing cipher
*/ */
void void
TALER_planchet_setup_random (struct TALER_PlanchetSecretsP *ps, TALER_planchet_setup_random (
const struct struct TALER_PlanchetSecretsP *ps,
TALER_ExchangeWithdrawValues *alg_values); const struct TALER_ExchangeWithdrawValues *alg_values);
/** /**
* Create a blinding secret @a bs for @a cipher. * Create a blinding secret @a bs for @a cipher.

View File

@ -1461,7 +1461,6 @@ TALER_EXCHANGE_withdraw (
const struct TALER_EXCHANGE_DenomPublicKey *pk, const struct TALER_EXCHANGE_DenomPublicKey *pk,
const struct TALER_ReservePrivateKeyP *reserve_priv, const struct TALER_ReservePrivateKeyP *reserve_priv,
struct TALER_PlanchetSecretsP *ps, struct TALER_PlanchetSecretsP *ps,
struct TALER_ExchangeWithdrawValues *alg_values,
TALER_EXCHANGE_WithdrawCallback res_cb, TALER_EXCHANGE_WithdrawCallback res_cb,
void *res_cb_cls); void *res_cb_cls);

View File

@ -66,13 +66,11 @@ TALER_TESTING_make_wire_details (const char *payto);
* *
* @param keys array of keys to search * @param keys array of keys to search
* @param amount coin value to look for * @param amount coin value to look for
* @param cipher denomination cipher
* @return NULL if no matching key was found * @return NULL if no matching key was found
*/ */
const struct TALER_EXCHANGE_DenomPublicKey * const struct TALER_EXCHANGE_DenomPublicKey *
TALER_TESTING_find_pk (const struct TALER_EXCHANGE_Keys *keys, TALER_TESTING_find_pk (const struct TALER_EXCHANGE_Keys *keys,
const struct TALER_Amount *amount, const struct TALER_Amount *amount);
const enum TALER_DenominationCipher cipher);
/** /**
@ -1290,24 +1288,6 @@ TALER_TESTING_cmd_withdraw_amount (const char *label,
unsigned int expected_response_code); unsigned int expected_response_code);
/**
* 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 * Create a withdraw command, letting the caller specify
* the desired amount as string and also re-using an existing * the desired amount as string and also re-using an existing
@ -1332,30 +1312,6 @@ TALER_TESTING_cmd_withdraw_amount_reuse_key (
unsigned int expected_response_code); unsigned int expected_response_code);
/**
* 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 * Create withdraw command, letting the caller specify the
* amount by a denomination key. * amount by a denomination key.

View File

@ -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 * struct TALER_EXCHANGE_WithdrawHandle *
TALER_EXCHANGE_withdraw ( TALER_EXCHANGE_withdraw (
struct TALER_EXCHANGE_Handle *exchange, struct TALER_EXCHANGE_Handle *exchange,
const struct TALER_EXCHANGE_DenomPublicKey *pk, const struct TALER_EXCHANGE_DenomPublicKey *pk,
const struct TALER_ReservePrivateKeyP *reserve_priv, const struct TALER_ReservePrivateKeyP *reserve_priv,
struct TALER_PlanchetSecretsP *ps, struct TALER_PlanchetSecretsP *ps,
struct TALER_ExchangeWithdrawValues *alg_values,
TALER_EXCHANGE_WithdrawCallback res_cb, TALER_EXCHANGE_WithdrawCallback res_cb,
void *res_cb_cls) void *res_cb_cls)
{ {
@ -256,7 +237,6 @@ TALER_EXCHANGE_withdraw (
wh->cb_cls = res_cb_cls; wh->cb_cls = res_cb_cls;
wh->reserve_priv = reserve_priv; wh->reserve_priv = reserve_priv;
wh->ps = *ps; wh->ps = *ps;
wh->alg_values = *alg_values,
wh->pk = *pk; wh->pk = *pk;
wh->csrh = NULL; wh->csrh = NULL;

View File

@ -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
test_bank_api_with_fakebank_twisted test_bank_api_with_fakebank_twisted
test_bank_api_with_pybank test_bank_api_with_pybank
test_bank_api_with_pybank_twisted test_bank_api_with_pybank_twisted
test_taler_exchange_aggregator-postgres test_taler_exchange_aggregator-postgres
test_taler_exchange_wirewatch-postgres test_taler_exchange_wirewatch-postgres
test_exchange_api_revocation test_exchange_api_revocation_cs
test_exchange_api_revocation_rsa
report* 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-eddsa/
test_exchange_api_home/.local/share/taler/crypto-rsa/ test_exchange_api_home/.local/share/taler/crypto-rsa/
test_exchange_api_home/.local/share/taler/exchange/offline-keys/secm_tofus.priv test_exchange_api_home/.local/share/taler/exchange/offline-keys/secm_tofus.priv

View File

@ -114,16 +114,23 @@ AM_TESTS_ENVIRONMENT=export TALER_PREFIX=$${TALER_PREFIX:-@libdir@};export PATH=
.NOTPARALLEL: .NOTPARALLEL:
check_PROGRAMS = \ check_PROGRAMS = \
test_auditor_api \ test_auditor_api_cs \
test_auditor_api_version \ test_auditor_api_rsa \
test_auditor_api_version_rsa \
test_auditor_api_version_cs \
test_bank_api_with_fakebank \ test_bank_api_with_fakebank \
test_bank_api_with_pybank \ test_bank_api_with_pybank \
test_bank_api_with_nexus \ test_bank_api_with_nexus \
test_exchange_api \ test_exchange_api_cs \
test_exchange_api_keys_cherry_picking \ test_exchange_api_rsa \
test_exchange_api_revocation \ test_exchange_api_keys_cherry_picking_cs \
test_exchange_api_overlapping_keys_bug \ test_exchange_api_keys_cherry_picking_rsa \
test_exchange_management_api \ 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_kyc_api \
test_taler_exchange_aggregator-postgres \ test_taler_exchange_aggregator-postgres \
test_taler_exchange_wirewatch-postgres test_taler_exchange_wirewatch-postgres
@ -139,9 +146,25 @@ endif
TESTS = \ TESTS = \
$(check_PROGRAMS) $(check_PROGRAMS)
test_auditor_api_SOURCES = \ test_auditor_api_cs_SOURCES = \
test_auditor_api.c 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 \
$(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_rsa_SOURCES = \
test_auditor_api.c
test_auditor_api_rsa_LDADD = \
$(top_builddir)/src/lib/libtalerauditor.la \ $(top_builddir)/src/lib/libtalerauditor.la \
libtalertesting.la \ libtalertesting.la \
$(top_builddir)/src/lib/libtalerexchange.la \ $(top_builddir)/src/lib/libtalerexchange.la \
@ -156,9 +179,21 @@ test_auditor_api_LDADD = \
$(XLIB) $(XLIB)
test_auditor_api_version_SOURCES = \ test_auditor_api_version_cs_SOURCES = \
test_auditor_api_version.c test_auditor_api_version.c
test_auditor_api_version_LDADD = \ 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_rsa_SOURCES = \
test_auditor_api_version.c
test_auditor_api_version_rsa_LDADD = \
libtalertesting.la \ libtalertesting.la \
$(top_builddir)/src/lib/libtalerauditor.la \ $(top_builddir)/src/lib/libtalerauditor.la \
$(LIBGCRYPT_LIBS) \ $(LIBGCRYPT_LIBS) \
@ -195,9 +230,9 @@ test_bank_api_with_pybank_LDADD = \
$(top_builddir)/src/bank-lib/libtalerbank.la \ $(top_builddir)/src/bank-lib/libtalerbank.la \
$(XLIB) $(XLIB)
test_exchange_api_SOURCES = \ test_exchange_api_cs_SOURCES = \
test_exchange_api.c test_exchange_api.c
test_exchange_api_LDADD = \ test_exchange_api_cs_LDADD = \
libtalertesting.la \ libtalertesting.la \
$(top_builddir)/src/lib/libtalerexchange.la \ $(top_builddir)/src/lib/libtalerexchange.la \
$(LIBGCRYPT_LIBS) \ $(LIBGCRYPT_LIBS) \
@ -210,18 +245,9 @@ test_exchange_api_LDADD = \
-ljansson \ -ljansson \
$(XLIB) $(XLIB)
test_exchange_management_api_SOURCES = \ test_exchange_api_rsa_SOURCES = \
test_exchange_management_api.c test_exchange_api.c
test_exchange_management_api_LDADD = \ test_exchange_api_rsa_LDADD = \
libtalertesting.la \
$(top_builddir)/src/lib/libtalerexchange.la \
$(top_builddir)/src/util/libtalerutil.la \
-lgnunetutil \
$(XLIB)
test_exchange_api_revocation_SOURCES = \
test_exchange_api_revocation.c
test_exchange_api_revocation_LDADD = \
libtalertesting.la \ libtalertesting.la \
$(top_builddir)/src/lib/libtalerexchange.la \ $(top_builddir)/src/lib/libtalerexchange.la \
$(LIBGCRYPT_LIBS) \ $(LIBGCRYPT_LIBS) \
@ -234,9 +260,9 @@ test_exchange_api_revocation_LDADD = \
-ljansson \ -ljansson \
$(XLIB) $(XLIB)
test_exchange_api_keys_cherry_picking_SOURCES = \ test_exchange_api_keys_cherry_picking_cs_SOURCES = \
test_exchange_api_keys_cherry_picking.c test_exchange_api_keys_cherry_picking.c
test_exchange_api_keys_cherry_picking_LDADD = \ test_exchange_api_keys_cherry_picking_cs_LDADD = \
libtalertesting.la \ libtalertesting.la \
$(top_builddir)/src/lib/libtalerexchange.la \ $(top_builddir)/src/lib/libtalerexchange.la \
$(LIBGCRYPT_LIBS) \ $(LIBGCRYPT_LIBS) \
@ -248,9 +274,9 @@ test_exchange_api_keys_cherry_picking_LDADD = \
-ljansson \ -ljansson \
$(XLIB) $(XLIB)
test_exchange_api_overlapping_keys_bug_SOURCES = \ test_exchange_api_keys_cherry_picking_rsa_SOURCES = \
test_exchange_api_overlapping_keys_bug.c test_exchange_api_keys_cherry_picking.c
test_exchange_api_overlapping_keys_bug_LDADD = \ test_exchange_api_keys_cherry_picking_rsa_LDADD = \
libtalertesting.la \ libtalertesting.la \
$(top_builddir)/src/lib/libtalerexchange.la \ $(top_builddir)/src/lib/libtalerexchange.la \
$(LIBGCRYPT_LIBS) \ $(LIBGCRYPT_LIBS) \
@ -262,6 +288,84 @@ test_exchange_api_overlapping_keys_bug_LDADD = \
-ljansson \ -ljansson \
$(XLIB) $(XLIB)
test_exchange_api_revocation_cs_SOURCES = \
test_exchange_api_revocation.c
test_exchange_api_revocation_cs_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_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) \
$(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_overlapping_keys_bug_rsa_SOURCES = \
test_exchange_api_overlapping_keys_bug.c
test_exchange_api_overlapping_keys_bug_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_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_postgres_SOURCES = \
test_taler_exchange_aggregator.c test_taler_exchange_aggregator.c
test_taler_exchange_aggregator_postgres_LDADD = \ test_taler_exchange_aggregator_postgres_LDADD = \

View File

@ -94,14 +94,3 @@ fee_refresh = EUR:0.01
fee_refund = EUR:0.01 fee_refund = EUR:0.01
CIPHER = RSA CIPHER = RSA
rsa_keysize = 1024 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

View File

@ -83,14 +83,3 @@ fee_refresh = EUR:0.01
fee_refund = EUR:0.01 fee_refund = EUR:0.01
CIPHER = RSA CIPHER = RSA
rsa_keysize = 1024 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

View File

@ -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

View File

@ -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

View File

@ -39,10 +39,9 @@
* Configuration file we use. One (big) configuration is used * Configuration file we use. One (big) configuration is used
* for the various components for this test. * for the various components for this test.
*/ */
#define CONFIG_FILE "test_auditor_api.conf" static char *config_file;
#define CONFIG_FILE_EXPIRE_RESERVE_NOW \ static char *config_file_expire_reserve_now;
"test_auditor_api_expire_reserve_now.conf"
/** /**
* Exchange configuration data. * Exchange configuration data.
@ -61,7 +60,7 @@ static struct TALER_TESTING_BankConfiguration bc;
* @param label label to use for the command. * @param label label to use for the command.
*/ */
#define CMD_EXEC_WIREWATCH(label) \ #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 * 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) \ #define CMD_EXEC_AGGREGATOR(label) \
TALER_TESTING_cmd_sleep (label "-sleep", 1), \ TALER_TESTING_cmd_sleep (label "-sleep", 1), \
TALER_TESTING_cmd_exec_aggregator (label, CONFIG_FILE), \ TALER_TESTING_cmd_exec_aggregator (label, config_file), \
TALER_TESTING_cmd_exec_transfer (label, CONFIG_FILE) TALER_TESTING_cmd_exec_transfer (label, config_file)
/** /**
* Run wire transfer of funds from some user's account to the * 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. * @param label label to use for the command.
*/ */
#define CMD_RUN_AUDITOR(label) \ #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", TALER_TESTING_cmd_revoke ("revoke-1",
MHD_HTTP_OK, MHD_HTTP_OK,
"recoup-withdraw-coin-1", "recoup-withdraw-coin-1",
CONFIG_FILE), config_file),
TALER_TESTING_cmd_recoup ("recoup-1", TALER_TESTING_cmd_recoup ("recoup-1",
MHD_HTTP_OK, MHD_HTTP_OK,
"recoup-withdraw-coin-1", "recoup-withdraw-coin-1",
@ -426,9 +425,9 @@ run (void *cls,
CMD_TRANSFER_TO_EXCHANGE ("short-lived-reserve", CMD_TRANSFER_TO_EXCHANGE ("short-lived-reserve",
"EUR:5.01"), "EUR:5.01"),
TALER_TESTING_cmd_exec_wirewatch ("short-lived-aggregation", 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", 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 * Fill reserve with EUR:2.02, as withdraw fee is 1 ct per
* config, then withdraw two coin, partially spend one, and * config, then withdraw two coin, partially spend one, and
@ -466,7 +465,7 @@ run (void *cls,
TALER_TESTING_cmd_revoke ("revoke-2", TALER_TESTING_cmd_revoke ("revoke-2",
MHD_HTTP_OK, MHD_HTTP_OK,
"recoup-withdraw-coin-2a", "recoup-withdraw-coin-2a",
CONFIG_FILE), config_file),
TALER_TESTING_cmd_recoup ("recoup-2", TALER_TESTING_cmd_recoup ("recoup-2",
MHD_HTTP_OK, MHD_HTTP_OK,
"recoup-withdraw-coin-2a", "recoup-withdraw-coin-2a",
@ -631,7 +630,7 @@ run (void *cls,
struct TALER_TESTING_Command commands[] = { struct TALER_TESTING_Command commands[] = {
TALER_TESTING_cmd_exec_offline_sign_fees ("offline-sign-fees", TALER_TESTING_cmd_exec_offline_sign_fees ("offline-sign-fees",
CONFIG_FILE, config_file,
"EUR:0.01", "EUR:0.01",
"EUR:0.01"), "EUR:0.01"),
TALER_TESTING_cmd_auditor_add ("add-auditor-OK", TALER_TESTING_cmd_auditor_add ("add-auditor-OK",
@ -642,11 +641,11 @@ run (void *cls,
MHD_HTTP_NO_CONTENT, MHD_HTTP_NO_CONTENT,
false), false),
TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys", 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", TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys",
2), 2),
TALER_TESTING_cmd_exec_auditor_offline ("auditor-offline", TALER_TESTING_cmd_exec_auditor_offline ("auditor-offline",
CONFIG_FILE), config_file),
CMD_RUN_AUDITOR ("virgin-auditor"), CMD_RUN_AUDITOR ("virgin-auditor"),
TALER_TESTING_cmd_exchanges_with_url ("check-exchange", TALER_TESTING_cmd_exchanges_with_url ("check-exchange",
MHD_HTTP_OK, MHD_HTTP_OK,
@ -682,25 +681,36 @@ int
main (int argc, main (int argc,
char *const *argv) char *const *argv)
{ {
const char *cipher;
(void) argc; (void) argc;
(void) argv;
/* These environment variables get in the way... */ /* These environment variables get in the way... */
unsetenv ("XDG_DATA_HOME"); unsetenv ("XDG_DATA_HOME");
unsetenv ("XDG_CONFIG_HOME"); unsetenv ("XDG_CONFIG_HOME");
GNUNET_log_setup ("test-auditor-api", GNUNET_log_setup (argv[0],
"INFO", "INFO",
NULL); NULL);
/* Check fakebank port is available and get configuration data. */ /* Check fakebank port is available and get configuration data. */
if (GNUNET_OK != if (GNUNET_OK !=
TALER_TESTING_prepare_fakebank (CONFIG_FILE, TALER_TESTING_prepare_fakebank (config_file,
"exchange-account-2", "exchange-account-2",
&bc)) &bc))
return 77; 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 /* @helpers. Run keyup, create tables, ... Note: it
* fetches the port number from config in order to see * fetches the port number from config in order to see
* if it's available. */ * if it's available. */
switch (TALER_TESTING_prepare_exchange (CONFIG_FILE, switch (TALER_TESTING_prepare_exchange (config_file,
GNUNET_YES, GNUNET_YES,
&ec)) &ec))
{ {
@ -717,7 +727,7 @@ main (int argc,
*/ */
TALER_TESTING_auditor_setup (&run, TALER_TESTING_auditor_setup (&run,
NULL, NULL,
CONFIG_FILE)) config_file))
return 1; return 1;
break; break;
default: default:

View File

@ -1,6 +1,6 @@
# This file is in the public domain. # This file is in the public domain.
# #
[PATHS] [PATHS]
# Persistent data storage for the testcase # Persistent data storage for the testcase
TALER_TEST_HOME = test_exchange_api_home/ 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 # Reduce from 1 year to speed up test
LOOKAHEAD_SIGN = 24 days LOOKAHEAD_SIGN = 24 days
[taler-exchange-secmod-cs]
# Reduce from 1 year to speed up test
LOOKAHEAD_SIGN = 24 days
[taler-exchange-secmod-eddsa] [taler-exchange-secmod-eddsa]
# Reduce from 1 year to speed up test # Reduce from 1 year to speed up test
LOOKAHEAD_SIGN = 24 days LOOKAHEAD_SIGN = 24 days
# Reduce from 12 weeks to ensure we have multiple # Reduce from 12 weeks to ensure we have multiple
DURATION = 14 days DURATION = 14 days
[taler] [taler]
# Currency supported by the exchange (can only be one) # Currency supported by the exchange (can only be one)
CURRENCY = EUR CURRENCY = EUR
@ -32,10 +27,11 @@ BASE_URL = "http://localhost:8083/"
# HTTP port the auditor listens to # HTTP port the auditor listens to
PORT = 8083 PORT = 8083
TINY_AMOUNT = EUR:0.01
[exchange] [exchange]
TERMS_ETAG = 0
PRIVACY_ETAG = 0
# HTTP port the exchange listens to # HTTP port the exchange listens to
PORT = 8081 PORT = 8081
@ -61,14 +57,10 @@ CONFIG = "postgres:///talercheck"
[exchange-account-1] [exchange-account-1]
# What is the URL of our account? # What is the URL of our account?
PAYTO_URI = "payto://x-taler-bank/localhost/42" PAYTO_URI = "payto://x-taler-bank/localhost/42"
# ENABLE_CREDIT = YES
[exchange-accountcredentials-1] [exchange-accountcredentials-1]
WIRE_GATEWAY_URL = "http://localhost:8082/42/" WIRE_GATEWAY_URL = "http://localhost:9081/42/"
[bank]
HTTP_PORT = 8082
# ENABLE_CREDIT = YES
[exchange-account-2] [exchange-account-2]
# What is the bank account (with the "Taler Bank" demo system)? # 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_DEBIT = YES
ENABLE_CREDIT = YES ENABLE_CREDIT = YES
# Authentication information for basic authentication
[exchange-accountcredentials-2] [exchange-accountcredentials-2]
WIRE_GATEWAY_URL = "http://localhost:8082/2/" WIRE_GATEWAY_AUTH_METHOD = basic
WIRE_GATEWAY_AUTH_METHOD = "basic" USERNAME = Exchange
USERNAME = user PASSWORD = x
PASSWORD = pass 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 # Sections starting with "coin_" specify which denominations
# the exchange should support (and their respective fee structure) # the exchange should support (and their respective fee structure)
@ -97,18 +94,6 @@ fee_withdraw = EUR:0.00
fee_deposit = EUR:0.00 fee_deposit = EUR:0.00
fee_refresh = EUR:0.01 fee_refresh = EUR:0.01
fee_refund = 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 CIPHER = CS
[coin_eur_ct_10] [coin_eur_ct_10]
@ -120,18 +105,6 @@ fee_withdraw = EUR:0.01
fee_deposit = EUR:0.01 fee_deposit = EUR:0.01
fee_refresh = EUR:0.03 fee_refresh = EUR:0.03
fee_refund = EUR:0.01 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 CIPHER = CS
[coin_eur_1] [coin_eur_1]
@ -143,18 +116,6 @@ fee_withdraw = EUR:0.01
fee_deposit = EUR:0.01 fee_deposit = EUR:0.01
fee_refresh = EUR:0.03 fee_refresh = EUR:0.03
fee_refund = EUR:0.01 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 CIPHER = CS
[coin_eur_5] [coin_eur_5]
@ -166,18 +127,6 @@ fee_withdraw = EUR:0.01
fee_deposit = EUR:0.01 fee_deposit = EUR:0.01
fee_refresh = EUR:0.03 fee_refresh = EUR:0.03
fee_refund = EUR:0.01 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 CIPHER = CS
[coin_eur_10] [coin_eur_10]
@ -189,10 +138,57 @@ fee_withdraw = EUR:0.01
fee_deposit = EUR:0.01 fee_deposit = EUR:0.01
fee_refresh = EUR:0.03 fee_refresh = EUR:0.03
fee_refund = EUR:0.01 fee_refund = EUR:0.01
CIPHER = RSA CIPHER = CS
rsa_keysize = 1024
[coin_eur_11] [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
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_1_age_restricted]
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
age_restricted = true
CIPHER = CS
[coin_eur_5_age_restricted]
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
age_restricted = true
CIPHER = CS
[coin_eur_10_age_restricted]
value = EUR:10 value = EUR:10
duration_withdraw = 7 days duration_withdraw = 7 days
duration_spend = 2 years duration_spend = 2 years
@ -201,4 +197,5 @@ fee_withdraw = EUR:0.01
fee_deposit = EUR:0.01 fee_deposit = EUR:0.01
fee_refresh = EUR:0.03 fee_refresh = EUR:0.03
fee_refund = EUR:0.01 fee_refund = EUR:0.01
age_restricted = true
CIPHER = CS CIPHER = CS

View File

@ -38,10 +38,9 @@
* Configuration file we use. One (big) configuration is used * Configuration file we use. One (big) configuration is used
* for the various components for this test. * for the various components for this test.
*/ */
#define CONFIG_FILE "test_exchange_api.conf" static char *config_file;
#define CONFIG_FILE_EXPIRE_RESERVE_NOW \ static char *config_file_expire_reserve_now;
"test_exchange_api_expire_reserve_now.conf"
/** /**
@ -62,7 +61,7 @@ static struct TALER_TESTING_BankConfiguration bc;
* @param label label to use for the command. * @param label label to use for the command.
*/ */
#define CMD_EXEC_WIREWATCH(label) \ #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 * 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. * @param label label to use for the command.
*/ */
#define CMD_EXEC_AGGREGATOR(label) \ #define CMD_EXEC_AGGREGATOR(label) \
TALER_TESTING_cmd_exec_aggregator (label "-aggregator", CONFIG_FILE), \ TALER_TESTING_cmd_exec_aggregator (label "-aggregator", config_file), \
TALER_TESTING_cmd_exec_transfer (label "-transfer", 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", TALER_TESTING_cmd_revoke ("revoke-0-EUR:5",
MHD_HTTP_OK, MHD_HTTP_OK,
"recoup-withdraw-coin-1", "recoup-withdraw-coin-1",
CONFIG_FILE), config_file),
/* Recoup coin to reserve */ /* Recoup coin to reserve */
TALER_TESTING_cmd_recoup ("recoup-1", TALER_TESTING_cmd_recoup ("recoup-1",
MHD_HTTP_OK, MHD_HTTP_OK,
@ -779,14 +778,14 @@ run (void *cls,
bc.exchange_payto, bc.exchange_payto,
"short-lived-reserve"), "short-lived-reserve"),
TALER_TESTING_cmd_exec_wirewatch ("short-lived-aggregation", 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", TALER_TESTING_cmd_exec_closer ("close-reserves",
CONFIG_FILE_EXPIRE_RESERVE_NOW, config_file_expire_reserve_now,
"EUR:5", "EUR:5",
"EUR:0.01", "EUR:0.01",
"short-lived-reserve"), "short-lived-reserve"),
TALER_TESTING_cmd_exec_transfer ("close-reserves-transfer", 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", TALER_TESTING_cmd_status ("short-lived-status",
"short-lived-reserve", "short-lived-reserve",
@ -836,7 +835,7 @@ run (void *cls,
TALER_TESTING_cmd_revoke ("revoke-1-EUR:1", TALER_TESTING_cmd_revoke ("revoke-1-EUR:1",
MHD_HTTP_OK, MHD_HTTP_OK,
"recoup-withdraw-coin-2a", "recoup-withdraw-coin-2a",
CONFIG_FILE), config_file),
/* Check recoup is failing for the coin with the reused coin key */ /* Check recoup is failing for the coin with the reused coin key */
TALER_TESTING_cmd_recoup ("recoup-2x", TALER_TESTING_cmd_recoup ("recoup-2x",
MHD_HTTP_CONFLICT, MHD_HTTP_CONFLICT,
@ -891,145 +890,6 @@ run (void *cls,
TALER_TESTING_cmd_end () 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_CHUNK 4
#define RESERVE_OPEN_CLOSE_ITERATIONS 3 #define RESERVE_OPEN_CLOSE_ITERATIONS 3
@ -1047,10 +907,10 @@ run (void *cls,
"EUR:20"); "EUR:20");
reserve_open_close[(i * RESERVE_OPEN_CLOSE_CHUNK) + 1] reserve_open_close[(i * RESERVE_OPEN_CLOSE_CHUNK) + 1]
= TALER_TESTING_cmd_exec_wirewatch ("reserve-open-close-wirewatch", = 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] reserve_open_close[(i * RESERVE_OPEN_CLOSE_CHUNK) + 2]
= TALER_TESTING_cmd_exec_closer ("reserve-open-close-aggregation", = TALER_TESTING_cmd_exec_closer ("reserve-open-close-aggregation",
CONFIG_FILE_EXPIRE_RESERVE_NOW, config_file_expire_reserve_now,
"EUR:19.99", "EUR:19.99",
"EUR:0.01", "EUR:0.01",
"reserve-open-close-key"); "reserve-open-close-key");
@ -1074,9 +934,9 @@ run (void *cls,
MHD_HTTP_NO_CONTENT, MHD_HTTP_NO_CONTENT,
false), false),
TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys", 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", TALER_TESTING_cmd_exec_offline_sign_fees ("offline-sign-fees",
CONFIG_FILE, config_file,
"EUR:0.01", "EUR:0.01",
"EUR:0.01"), "EUR:0.01"),
TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys", TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys",
@ -1099,13 +959,6 @@ run (void *cls,
refund), refund),
TALER_TESTING_cmd_batch ("recoup", TALER_TESTING_cmd_batch ("recoup",
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", TALER_TESTING_cmd_batch ("reserve-open-close",
reserve_open_close), reserve_open_close),
/* End the suite. */ /* End the suite. */
@ -1123,25 +976,34 @@ int
main (int argc, main (int argc,
char *const *argv) char *const *argv)
{ {
const char *cipher;
(void) argc; (void) argc;
(void) argv;
/* These environment variables get in the way... */ /* These environment variables get in the way... */
unsetenv ("XDG_DATA_HOME"); unsetenv ("XDG_DATA_HOME");
unsetenv ("XDG_CONFIG_HOME"); unsetenv ("XDG_CONFIG_HOME");
GNUNET_log_setup ("test-exchange-api", GNUNET_log_setup (argv[0],
"INFO", "INFO",
NULL); 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 */ /* Check fakebank port is available and get config */
if (GNUNET_OK != if (GNUNET_OK !=
TALER_TESTING_prepare_fakebank (CONFIG_FILE, TALER_TESTING_prepare_fakebank (config_file,
"exchange-account-2", "exchange-account-2",
&bc)) &bc))
return 77; return 77;
TALER_TESTING_cleanup_files (CONFIG_FILE); TALER_TESTING_cleanup_files (config_file);
/* @helpers. Run keyup, create tables, ... Note: it /* @helpers. Run keyup, create tables, ... Note: it
* fetches the port number from config in order to see * fetches the port number from config in order to see
* if it's available. */ * if it's available. */
switch (TALER_TESTING_prepare_exchange (CONFIG_FILE, switch (TALER_TESTING_prepare_exchange (config_file,
GNUNET_YES, GNUNET_YES,
&ec)) &ec))
{ {
@ -1158,7 +1020,7 @@ main (int argc,
*/ */
TALER_TESTING_setup_with_exchange (&run, TALER_TESTING_setup_with_exchange (&run,
NULL, NULL,
CONFIG_FILE)) config_file))
return 1; return 1;
break; break;
default: default:

View File

@ -97,17 +97,6 @@ fee_refund = EUR:0.01
CIPHER = RSA CIPHER = RSA
rsa_keysize = 1024 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] [coin_eur_ct_10]
value = EUR:0.10 value = EUR:0.10
duration_withdraw = 7 days duration_withdraw = 7 days
@ -120,17 +109,6 @@ fee_refund = EUR:0.01
CIPHER = RSA CIPHER = RSA
rsa_keysize = 1024 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] [coin_eur_1]
value = EUR:1 value = EUR:1
duration_withdraw = 7 days duration_withdraw = 7 days
@ -143,17 +121,6 @@ fee_refund = EUR:0.01
CIPHER = RSA CIPHER = RSA
rsa_keysize = 1024 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] [coin_eur_5]
value = EUR:5 value = EUR:5
duration_withdraw = 7 days duration_withdraw = 7 days
@ -166,17 +133,6 @@ fee_refund = EUR:0.01
CIPHER = RSA CIPHER = RSA
rsa_keysize = 1024 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] [coin_eur_10]
value = EUR:10 value = EUR:10
duration_withdraw = 7 days duration_withdraw = 7 days
@ -241,7 +197,6 @@ rsa_keysize = 1024
age_restricted = true age_restricted = true
CIPHER = RSA CIPHER = RSA
[coin_eur_10_age_restricted] [coin_eur_10_age_restricted]
value = EUR:10 value = EUR:10
duration_withdraw = 7 days duration_withdraw = 7 days

View File

@ -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

View File

@ -39,7 +39,7 @@ lished
* Configuration file we use. One (big) configuration is used * Configuration file we use. One (big) configuration is used
* for the various components for this test. * for the various components for this test.
*/ */
#define CONFIG_FILE "test_exchange_api_keys_cherry_picking.conf" static char *config_file;
/** /**
* Exchange configuration data. * Exchange configuration data.
@ -66,11 +66,11 @@ run (void *cls,
MHD_HTTP_NO_CONTENT, MHD_HTTP_NO_CONTENT,
false), false),
TALER_TESTING_cmd_exec_offline_sign_fees ("offline-sign-fees", TALER_TESTING_cmd_exec_offline_sign_fees ("offline-sign-fees",
CONFIG_FILE, config_file,
"EUR:0.01", "EUR:0.01",
"EUR:0.01"), "EUR:0.01"),
TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys", 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", TALER_TESTING_cmd_check_keys_pull_all_keys ("initial-/keys",
1), 1),
TALER_TESTING_cmd_sleep ("sleep", TALER_TESTING_cmd_sleep ("sleep",
@ -109,19 +109,25 @@ int
main (int argc, main (int argc,
char *const *argv) char *const *argv)
{ {
const char *cipher;
(void) argc; (void) argc;
(void) argv;
/* These environment variables get in the way... */ /* These environment variables get in the way... */
unsetenv ("XDG_DATA_HOME"); unsetenv ("XDG_DATA_HOME");
unsetenv ("XDG_CONFIG_HOME"); unsetenv ("XDG_CONFIG_HOME");
GNUNET_log_setup ("test-exchange-api-cherry-picking", GNUNET_log_setup (argv[0],
"DEBUG", "DEBUG",
NULL); 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 /* @helpers. Run keyup, create tables, ... Note: it
* fetches the port number from config in order to see * fetches the port number from config in order to see
* if it's available. */ * if it's available. */
switch (TALER_TESTING_prepare_exchange (CONFIG_FILE, switch (TALER_TESTING_prepare_exchange (config_file,
GNUNET_YES, GNUNET_YES,
&ec)) &ec))
{ {
@ -138,7 +144,7 @@ main (int argc,
*/ */
TALER_TESTING_setup_with_exchange (&run, TALER_TESTING_setup_with_exchange (&run,
NULL, NULL,
CONFIG_FILE)) config_file))
return 1; return 1;
break; break;
default: default:

View File

@ -22,10 +22,6 @@ CURRENCY = EUR
# Reduce from 1 year to speed up test # Reduce from 1 year to speed up test
LOOKAHEAD_SIGN = 24 days LOOKAHEAD_SIGN = 24 days
[taler-exchange-secmod-cs]
# Reduce from 1 year to speed up test
LOOKAHEAD_SIGN = 24 days
[taler-exchange-secmod-eddsa] [taler-exchange-secmod-eddsa]
# Reduce from 1 year to speed up test # Reduce from 1 year to speed up test
LOOKAHEAD_SIGN = 24 days LOOKAHEAD_SIGN = 24 days
@ -85,10 +81,6 @@ HTTP_PORT=8082
OVERLAP_DURATION = 1 s OVERLAP_DURATION = 1 s
LOOKAHEAD_SIGN = 20 s LOOKAHEAD_SIGN = 20 s
[taler-exchange-secmod-cs]
OVERLAP_DURATION = 1 s
LOOKAHEAD_SIGN = 20 s
[taler-exchange-secmod-eddsa] [taler-exchange-secmod-eddsa]
OVERLAP_DURATION = 1 s OVERLAP_DURATION = 1 s
DURATION = 30 s DURATION = 30 s
@ -105,14 +97,3 @@ fee_refresh = EUR:0.03
fee_refund = EUR:0.01 fee_refund = EUR:0.01
CIPHER = RSA CIPHER = RSA
rsa_keysize = 1024 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

View File

@ -38,7 +38,7 @@
* Configuration file we use. One (big) configuration is used * Configuration file we use. One (big) configuration is used
* for the various components for this test. * for the various components for this test.
*/ */
#define CONFIG_FILE "test_exchange_api.conf" static char *config_file;
/** /**
* Exchange configuration data. * Exchange configuration data.
@ -70,7 +70,7 @@ run (void *cls,
MHD_HTTP_NO_CONTENT, MHD_HTTP_NO_CONTENT,
false), false),
TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys", 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", TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys",
1), 1),
/** /**
@ -90,7 +90,7 @@ run (void *cls,
* Run wire-watch to trigger the reserve creation. * Run wire-watch to trigger the reserve creation.
*/ */
TALER_TESTING_cmd_exec_wirewatch ("wirewatch-4", TALER_TESTING_cmd_exec_wirewatch ("wirewatch-4",
CONFIG_FILE), config_file),
/* Withdraw a 5 EUR coin, at fee of 1 ct */ /* Withdraw a 5 EUR coin, at fee of 1 ct */
TALER_TESTING_cmd_withdraw_amount ("withdraw-revocation-coin-1", TALER_TESTING_cmd_withdraw_amount ("withdraw-revocation-coin-1",
"create-reserve-1", "create-reserve-1",
@ -144,12 +144,12 @@ run (void *cls,
TALER_TESTING_cmd_revoke ("revoke-2-EUR:5", TALER_TESTING_cmd_revoke ("revoke-2-EUR:5",
MHD_HTTP_OK, MHD_HTTP_OK,
"refresh-melt-1", "refresh-melt-1",
CONFIG_FILE), config_file),
/* Also make fully spent coin invalid (should be same denom) */ /* Also make fully spent coin invalid (should be same denom) */
TALER_TESTING_cmd_revoke ("revoke-2-EUR:5", TALER_TESTING_cmd_revoke ("revoke-2-EUR:5",
MHD_HTTP_OK, MHD_HTTP_OK,
"withdraw-revocation-coin-2", "withdraw-revocation-coin-2",
CONFIG_FILE), config_file),
/* Refund fully spent coin (which should fail) */ /* Refund fully spent coin (which should fail) */
TALER_TESTING_cmd_recoup ("recoup-fully-spent", TALER_TESTING_cmd_recoup ("recoup-fully-spent",
MHD_HTTP_CONFLICT, MHD_HTTP_CONFLICT,
@ -211,12 +211,12 @@ run (void *cls,
TALER_TESTING_cmd_revoke ("revoke-3-EUR:0.1", TALER_TESTING_cmd_revoke ("revoke-3-EUR:0.1",
MHD_HTTP_OK, MHD_HTTP_OK,
"refresh-reveal-2", "refresh-reveal-2",
CONFIG_FILE), config_file),
/* Revoke also original coin denomination */ /* Revoke also original coin denomination */
TALER_TESTING_cmd_revoke ("revoke-4-EUR:5", TALER_TESTING_cmd_revoke ("revoke-4-EUR:5",
MHD_HTTP_OK, MHD_HTTP_OK,
"withdraw-revocation-coin-1", "withdraw-revocation-coin-1",
CONFIG_FILE), config_file),
/* Refund coin EUR:0.1 to original coin, creating zombie! */ /* Refund coin EUR:0.1 to original coin, creating zombie! */
TALER_TESTING_cmd_recoup_refresh ("recoup-2", TALER_TESTING_cmd_recoup_refresh ("recoup-2",
MHD_HTTP_OK, MHD_HTTP_OK,
@ -248,25 +248,31 @@ int
main (int argc, main (int argc,
char *const *argv) char *const *argv)
{ {
const char *cipher;
(void) argc; (void) argc;
(void) argv;
/* These environment variables get in the way... */ /* These environment variables get in the way... */
unsetenv ("XDG_DATA_HOME"); unsetenv ("XDG_DATA_HOME");
unsetenv ("XDG_CONFIG_HOME"); unsetenv ("XDG_CONFIG_HOME");
GNUNET_log_setup ("test-exchange-api-revocation", GNUNET_log_setup (argv[0],
"INFO", "INFO",
NULL); 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 */ /* Check fakebank port is available and get config */
if (GNUNET_OK != if (GNUNET_OK !=
TALER_TESTING_prepare_fakebank (CONFIG_FILE, TALER_TESTING_prepare_fakebank (config_file,
"exchange-account-2", "exchange-account-2",
&bc)) &bc))
return 77; return 77;
TALER_TESTING_cleanup_files (CONFIG_FILE); TALER_TESTING_cleanup_files (config_file);
/* @helpers. Run keyup, create tables, ... Note: it /* @helpers. Run keyup, create tables, ... Note: it
* fetches the port number from config in order to see * fetches the port number from config in order to see
* if it's available. */ * if it's available. */
switch (TALER_TESTING_prepare_exchange (CONFIG_FILE, switch (TALER_TESTING_prepare_exchange (config_file,
GNUNET_YES, GNUNET_YES,
&ec)) &ec))
{ {
@ -283,7 +289,7 @@ main (int argc,
*/ */
TALER_TESTING_setup_with_exchange (&run, TALER_TESTING_setup_with_exchange (&run,
NULL, NULL,
CONFIG_FILE)) config_file))
return 1; return 1;
break; break;
default: default:

View File

@ -40,7 +40,7 @@
* Configuration file we use. One (big) configuration is used * Configuration file we use. One (big) configuration is used
* for the various components for this test. * 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. * (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) CMD_EXEC_WIREWATCH (const char *label)
{ {
return TALER_TESTING_cmd_exec_wirewatch (label, return TALER_TESTING_cmd_exec_wirewatch (label,
CONFIG_FILE); config_file);
} }
@ -142,7 +142,7 @@ run (void *cls,
NULL), NULL),
/* Trigger 409 Conflict. */ /* Trigger 409 Conflict. */
TALER_TESTING_cmd_flip_upload ("flip-upload", TALER_TESTING_cmd_flip_upload ("flip-upload",
CONFIG_FILE, config_file,
"transfer_privs.0"), "transfer_privs.0"),
TALER_TESTING_cmd_refresh_reveal ("refresh-(flipped-)reveal", TALER_TESTING_cmd_refresh_reveal ("refresh-(flipped-)reveal",
"refresh-melt", "refresh-melt",
@ -178,7 +178,7 @@ run (void *cls,
"USD:5", "USD:5",
"deposit-refund-1"), "deposit-refund-1"),
TALER_TESTING_cmd_flip_upload ("flip-upload", TALER_TESTING_cmd_flip_upload ("flip-upload",
CONFIG_FILE, config_file,
"merchant_sig"), "merchant_sig"),
TALER_TESTING_cmd_refund ("refund-bad-sig", TALER_TESTING_cmd_refund ("refund-bad-sig",
MHD_HTTP_FORBIDDEN, MHD_HTTP_FORBIDDEN,
@ -217,7 +217,7 @@ run (void *cls,
*/ */
struct TALER_TESTING_Command expired_keys[] = { struct TALER_TESTING_Command expired_keys[] = {
TALER_TESTING_cmd_modify_header_dl ("modify-expiration", TALER_TESTING_cmd_modify_header_dl ("modify-expiration",
CONFIG_FILE, config_file,
MHD_HTTP_HEADER_EXPIRES, MHD_HTTP_HEADER_EXPIRES,
"Wed, 19 Jan 586524 08:01:49 GMT"), "Wed, 19 Jan 586524 08:01:49 GMT"),
TALER_TESTING_cmd_check_keys_pull_all_keys ( TALER_TESTING_cmd_check_keys_pull_all_keys (
@ -243,7 +243,7 @@ run (void *cls,
MHD_HTTP_NO_CONTENT, MHD_HTTP_NO_CONTENT,
false), false),
TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys", 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", TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys",
1), 1),
TALER_TESTING_cmd_batch ("refresh-reveal-409-conflict", TALER_TESTING_cmd_batch ("refresh-reveal-409-conflict",
@ -283,26 +283,31 @@ int
main (int argc, main (int argc,
char *const *argv) char *const *argv)
{ {
const char *cipher;
int ret; int ret;
(void) argc; (void) argc;
(void) argv;
/* These environment variables get in the way... */ /* These environment variables get in the way... */
unsetenv ("XDG_DATA_HOME"); unsetenv ("XDG_DATA_HOME");
unsetenv ("XDG_CONFIG_HOME"); unsetenv ("XDG_CONFIG_HOME");
GNUNET_log_setup ("test-exchange-api-twisted", GNUNET_log_setup (argv[0],
"DEBUG", "DEBUG",
NULL); 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 != if (GNUNET_OK !=
TALER_TESTING_prepare_fakebank (CONFIG_FILE, TALER_TESTING_prepare_fakebank (config_file,
"exchange-account-2", "exchange-account-2",
&bc)) &bc))
return 77; return 77;
if (NULL == (twister_url = TALER_TWISTER_prepare_twister if (NULL == (twister_url = TALER_TWISTER_prepare_twister
(CONFIG_FILE))) (config_file)))
return 77; return 77;
TALER_TESTING_cleanup_files (CONFIG_FILE); TALER_TESTING_cleanup_files (config_file);
switch (TALER_TESTING_prepare_exchange (CONFIG_FILE, switch (TALER_TESTING_prepare_exchange (config_file,
GNUNET_YES, GNUNET_YES,
&ec)) &ec))
{ {
@ -312,11 +317,11 @@ main (int argc,
case GNUNET_NO: case GNUNET_NO:
return 77; return 77;
case GNUNET_OK: case GNUNET_OK:
if (NULL == (twisterd = TALER_TWISTER_run_twister (CONFIG_FILE))) if (NULL == (twisterd = TALER_TWISTER_run_twister (config_file)))
return 77; return 77;
ret = TALER_TESTING_setup_with_exchange (&run, ret = TALER_TESTING_setup_with_exchange (&run,
NULL, NULL,
CONFIG_FILE); config_file);
purge_process (twisterd); purge_process (twisterd);
GNUNET_free (twister_url); GNUNET_free (twister_url);

View File

@ -1049,9 +1049,7 @@ melt_run (void *cls,
return; return;
} }
fresh_pk = TALER_TESTING_find_pk (TALER_EXCHANGE_get_keys (is->exchange), fresh_pk = TALER_TESTING_find_pk (TALER_EXCHANGE_get_keys (is->exchange),
&fresh_amount, &fresh_amount);
// FIXME: replace hardcoded value
TALER_DENOMINATION_RSA);
if (NULL == fresh_pk) if (NULL == fresh_pk)
{ {
GNUNET_break (0); GNUNET_break (0);

View File

@ -72,11 +72,6 @@ struct WithdrawState
*/ */
struct TALER_Amount amount; 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 * If @e amount is NULL, this specifies the denomination key to
* use. Otherwise, this will be set (by the interpreter) to the * use. Otherwise, this will be set (by the interpreter) to the
@ -120,11 +115,6 @@ struct WithdrawState
*/ */
struct TALER_PlanchetSecretsP ps; struct TALER_PlanchetSecretsP ps;
/**
* Withdraw Values used for planchet creation
*/
struct TALER_ExchangeWithdrawValues alg_values;
/** /**
* Reserve history entry that corresponds to this operation. * Reserve history entry that corresponds to this operation.
* Will be of type #TALER_EXCHANGE_RTT_WITHDRAWAL. * Will be of type #TALER_EXCHANGE_RTT_WITHDRAWAL.
@ -396,10 +386,9 @@ withdraw_run (void *cls,
ws->reserve_payto_uri ws->reserve_payto_uri
= TALER_payto_from_reserve (ws->exchange_url, = TALER_payto_from_reserve (ws->exchange_url,
&ws->reserve_pub); &ws->reserve_pub);
ws->alg_values.cipher = ws->cipher;
if (NULL == ws->reuse_coin_key_ref) 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 else
{ {
@ -420,14 +409,13 @@ withdraw_run (void *cls,
TALER_TESTING_get_trait_coin_priv (cref, TALER_TESTING_get_trait_coin_priv (cref,
index, index,
&coin_priv)); &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; ws->ps.coin_priv = *coin_priv;
} }
if (NULL == ws->pk) if (NULL == ws->pk)
{ {
dpk = TALER_TESTING_find_pk (TALER_EXCHANGE_get_keys (is->exchange), dpk = TALER_TESTING_find_pk (TALER_EXCHANGE_get_keys (is->exchange),
&ws->amount, &ws->amount);
ws->cipher);
if (NULL == dpk) if (NULL == dpk)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@ -455,7 +443,6 @@ withdraw_run (void *cls,
ws->pk, ws->pk,
rp, rp,
&ws->ps, &ws->ps,
&ws->alg_values,
&reserve_withdraw_cb, &reserve_withdraw_cb,
ws); ws);
if (NULL == ws->wsh) if (NULL == ws->wsh)
@ -570,8 +557,6 @@ TALER_TESTING_cmd_withdraw_amount (const char *label,
const char *amount, const char *amount,
unsigned int expected_response_code) 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; struct WithdrawState *ws;
ws = GNUNET_new (struct WithdrawState); ws = GNUNET_new (struct WithdrawState);
@ -587,43 +572,6 @@ TALER_TESTING_cmd_withdraw_amount (const char *label,
GNUNET_assert (0); GNUNET_assert (0);
} }
ws->expected_response_code = expected_response_code; 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 = { struct TALER_TESTING_Command cmd = {
.cls = ws, .cls = ws,
@ -661,8 +609,6 @@ TALER_TESTING_cmd_withdraw_amount_reuse_key (
const char *coin_ref, const char *coin_ref,
unsigned int expected_response_code) 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; struct TALER_TESTING_Command cmd;
cmd = TALER_TESTING_cmd_withdraw_amount (label, 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 * Create withdraw command, letting the caller specify the
* amount by a denomination key. * amount by a denomination key.
@ -733,7 +656,6 @@ TALER_TESTING_cmd_withdraw_denomination (
ws->reserve_reference = reserve_reference; ws->reserve_reference = reserve_reference;
ws->pk = TALER_EXCHANGE_copy_denomination_key (dk); ws->pk = TALER_EXCHANGE_copy_denomination_key (dk);
ws->expected_response_code = expected_response_code; ws->expected_response_code = expected_response_code;
ws->cipher = dk->key.cipher;
{ {
struct TALER_TESTING_Command cmd = { struct TALER_TESTING_Command cmd = {
.cls = ws, .cls = ws,

View File

@ -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 * const struct TALER_EXCHANGE_DenomPublicKey *
TALER_TESTING_find_pk (const struct TALER_EXCHANGE_Keys *keys, TALER_TESTING_find_pk (const struct TALER_EXCHANGE_Keys *keys,
const struct TALER_Amount *amount, const struct TALER_Amount *amount)
const enum TALER_DenominationCipher cipher)
{ {
struct GNUNET_TIME_Timestamp now; struct GNUNET_TIME_Timestamp now;
struct TALER_EXCHANGE_DenomPublicKey *pk; 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++) for (unsigned int i = 0; i<keys->num_denom_keys; i++)
{ {
pk = &keys->denom_keys[i]; pk = &keys->denom_keys[i];
if (cipher != pk->key.cipher)
continue;
if ( (0 == TALER_amount_cmp (amount, if ( (0 == TALER_amount_cmp (amount,
&pk->value)) && &pk->value)) &&
(GNUNET_TIME_timestamp_cmp (now, (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++) for (unsigned int i = 0; i<keys->num_denom_keys; i++)
{ {
pk = &keys->denom_keys[i]; pk = &keys->denom_keys[i];
if (cipher != pk->key.cipher)
continue;
if ( (0 == TALER_amount_cmp (amount, if ( (0 == TALER_amount_cmp (amount,
&pk->value)) && &pk->value)) &&
(GNUNET_TIME_timestamp_cmp (now, (GNUNET_TIME_timestamp_cmp (now,
@ -473,25 +460,6 @@ TALER_TESTING_find_pk (const struct TALER_EXCHANGE_Keys *keys,
return NULL; 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, GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"No denomination key for amount %s found\n", "No denomination key for amount %s found\n",
str); str);

View File

@ -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 void
TALER_planchet_setup_random (struct TALER_PlanchetSecretsP *ps, TALER_planchet_setup_coin_priv (
const struct struct TALER_CoinSpendPrivateKeyP *coin_priv)
TALER_ExchangeWithdrawValues *alg_values)
{ {
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_STRONG, GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_STRONG,
&ps->coin_priv, coin_priv,
sizeof (struct TALER_CoinSpendPrivateKeyP)); 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) switch (alg_values->cipher)
{ {
case TALER_DENOMINATION_INVALID: case TALER_DENOMINATION_INVALID: