summaryrefslogtreecommitdiff
path: root/src/merchant-tools/taler-merchant-setup-reserve.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-07-16 17:42:31 +0200
committerChristian Grothoff <christian@grothoff.org>2020-07-16 17:42:43 +0200
commitdabc4c25fcb012a28e191f206f553f7e2061cbf6 (patch)
tree4efe32df3af37e17ff10822b78957c629fcbd99d /src/merchant-tools/taler-merchant-setup-reserve.c
parentadd99bf305d986cf14805cc99767cf665a1ccacb (diff)
downloadmerchant-dabc4c25fcb012a28e191f206f553f7e2061cbf6.tar.gz
merchant-dabc4c25fcb012a28e191f206f553f7e2061cbf6.tar.bz2
merchant-dabc4c25fcb012a28e191f206f553f7e2061cbf6.zip
implement #6418
Diffstat (limited to 'src/merchant-tools/taler-merchant-setup-reserve.c')
-rw-r--r--src/merchant-tools/taler-merchant-setup-reserve.c59
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",