diff options
Diffstat (limited to 'src/merchant-tools/taler-merchant-setup-reserve.c')
-rw-r--r-- | src/merchant-tools/taler-merchant-setup-reserve.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/merchant-tools/taler-merchant-setup-reserve.c b/src/merchant-tools/taler-merchant-setup-reserve.c index 5d5f3935..e46c3a3e 100644 --- a/src/merchant-tools/taler-merchant-setup-reserve.c +++ b/src/merchant-tools/taler-merchant-setup-reserve.c @@ -65,6 +65,31 @@ static struct GNUNET_CURL_Context *ctx; */ static struct GNUNET_CURL_RescheduleContext *rc; +/** + * Username and password to use for client authentication + * (optional). + */ +static char *userpass; + +/** + * Type of the client's TLS certificate (optional). + */ +static char *certtype; + +/** + * File with the client's TLS certificate (optional). + */ +static char *certfile; + +/** + * File with the client's TLS private key (optional). + */ +static char *keyfile; + +/** + * Passphrase to decrypt client's TLS private key file (optional). + */ +static char *keypass; /** * Shutdown task (invoked when the process is being terminated) @@ -155,6 +180,15 @@ run (void *cls, ctx = GNUNET_CURL_init (&GNUNET_CURL_gnunet_scheduler_reschedule, &rc); rc = GNUNET_CURL_gnunet_rc_create (ctx); + if (NULL != userpass) + GNUNET_CURL_set_userpass (ctx, + userpass); + if (NULL != keyfile) + GNUNET_CURL_set_tlscert (ctx, + certtype, + certfile, + keyfile, + keypass); /* setup termination logic */ GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); @@ -195,18 +229,43 @@ main (int argc, "VALUE", "amount to be transferred into the reserve", &initial_amount)), + GNUNET_GETOPT_option_string ('A', + "auth", + "USERNAME:PASSWORD", + "use the given USERNAME and PASSWORD for client authentication", + &userpass)), + GNUNET_GETOPT_option_string ('C', + "cert", + "CERTFILE", + "name of the TLS client certificate file", + &certfile)), GNUNET_GETOPT_option_mandatory ( GNUNET_GETOPT_option_string ('e', "exchange-url", "URL", "base URL of the exchange to create the reserve at", &exchange_base_url)), + GNUNET_GETOPT_option_string ('k', + "key", + "KEYFILE", + "file with the private TLS key for TLS client authentication", + &keyfile)), GNUNET_GETOPT_option_mandatory ( GNUNET_GETOPT_option_string ('m', "merchant-url", "URL", "base URL of the merchant backend's REST API", &merchant_base_url)), + GNUNET_GETOPT_option_string ('p', + "pass", + "KEYFILEPASSPHRASE", + "passphrase needed to decrypt the TLS client private key file", + &keypass)), + GNUNET_GETOPT_option_string ('t', + "type", + "CERTTYPE", + "type of the TLS client certificate, defaults to PEM if not specified", + &certtype)), GNUNET_GETOPT_option_mandatory ( GNUNET_GETOPT_option_string ('w', "wire-method", |