commit 9f1ca1783f92c9f4e8ad795a5329dc60f78261b5
parent 78f0bae5a57c0954688053f584c84e5e580f12eb
Author: Christian Grothoff <christian@grothoff.org>
Date: Thu, 7 Dec 2017 07:28:45 +0100
changing tip_reserve_priv to tip_reserve_priv_filename (#5188)
Diffstat:
3 files changed, 32 insertions(+), 43 deletions(-)
diff --git a/doc/manual.texi b/doc/manual.texi
@@ -1063,18 +1063,7 @@ $ gnunet-ecc -g 1 tip.priv
@end example
to create a file with the private key that will be used to identify the
-reserve. Then, run
-
-@example
-$ gnunet-ecc --print-private-key tip.priv
-@end example
-
-to print out the corresponding private key. It will look like
-this:
-
-@example
-QPE24X8PBX3BZ6E7GQ5VAVHV32FWTTCADR0TRQ183MSSJD2CHNEG
-@end example
+reserve.
Now you can configure your backend. You need to enable tipping for
each instance separately, or you can use an instance only for
@@ -1087,8 +1076,8 @@ the following configuration:
KEYFILE = signing_key.priv
# replace the URL with the URL of the exchange you will use
TIP_EXCHANGE = https://exchange:443/
-# here put the output of gnunet-ecc -P tip.priv
-TIP_RESERVE_PRIV = ENK9E0GYJ5EJEEC0QN3GY7KJRMNXW3B2SSWQDNJ3F1CEMFGC0970
+# here put the path to the file created with "gnunet-ecc -g1 tip.priv"
+TIP_RESERVE_PRIV_FILENAME = tip.priv
@end example
Note that the KEYFILE option should have already been present for
@@ -1099,8 +1088,8 @@ Instead of manually editing the configuration, you could also run:
@example
$ taler-config -s merchant-instance-default \
- -o TIP_RESERVE_PRIV \
- -V `gnunet-ecc -P tip.priv`
+ -o TIP_RESERVE_PRIV_FILENAME \
+ -V tip.priv
$ taler-config -s merchant-instance-default \
-o TIP_EXCHANGE \
-V https://exchange:443/
@@ -1118,9 +1107,7 @@ To fund the reserve, you must first extract the public key from ``tip.priv'':
$ gnunet-ecc --print-public-key tip.priv
@end example
-The result will look very much like the private key, so be
-very careful to not confuse the two! In our example, the
-output for the public key is:
+In our example, the output for the public key is:
@example
QPE24X8PBX3BZ6E7GQ5VAVHV32FWTTCADR0TRQ183MSSJD2CHNEG
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c
@@ -551,35 +551,35 @@ instances_iterator_cb (void *cls,
&mi->tip_exchange))
{
char *tip_reserves;
+ struct GNUNET_CRYPTO_EddsaPrivateKey *pk;
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (iic->config,
section,
- "TIP_RESERVE_PRIV",
+ "TIP_RESERVE_PRIV_FILENAME",
&tip_reserves))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
section,
- "TIP_RESERVE_PRIV");
+ "TIP_RESERVE_PRIV_FILENAME");
GNUNET_free (mi);
GNUNET_SCHEDULER_shutdown ();
return;
}
- if (GNUNET_OK !=
- GNUNET_STRINGS_string_to_data (tip_reserves,
- strlen (tip_reserves),
- &mi->tip_reserve,
- sizeof (struct TALER_ReservePrivateKeyP)))
+ pk = GNUNET_CRYPTO_eddsa_key_create_from_file (tip_reserves);
+ if (NULL == pk)
{
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
section,
- "TIP_RESERVE_PRIV",
- "Must decode to private EdDSA key");
+ "TIP_RESERVE_PRIV_FILENAME",
+ "Failed to read private key");
GNUNET_free (tip_reserves);
GNUNET_free (mi);
GNUNET_SCHEDULER_shutdown ();
return;
}
+ mi->tip_reserve.eddsa_priv = *pk;
+ GNUNET_free (pk);
GNUNET_free (tip_reserves);
}
diff --git a/src/lib/test_merchant_api.c b/src/lib/test_merchant_api.c
@@ -2346,37 +2346,39 @@ interpreter_run (void *cls)
{
char *section;
char *keys;
-
+ struct GNUNET_CRYPTO_EddsaPrivateKey *pk;
+
GNUNET_asprintf (§ion,
"merchant-instance-%s",
cmd->details.admin_add_incoming.instance);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (cfg,
section,
- "TIP_RESERVE_PRIV",
+ "TIP_RESERVE_PRIV_FILENAME",
&keys))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Configuration fails to specify reserve private key in section %s\n",
+ "Configuration fails to specify reserve private key filename in section %s\n",
section);
GNUNET_free (section);
fail (is);
return;
}
- if (GNUNET_OK !=
- GNUNET_STRINGS_string_to_data (keys,
- strlen (keys),
- &cmd->details.admin_add_incoming.reserve_priv,
- sizeof (struct TALER_ReservePrivateKeyP)))
+ pk = GNUNET_CRYPTO_eddsa_key_create_from_file (keys);
+ if (NULL == pk)
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Reserve private key in section %s fails to decode to EdDSA key\n",
- section);
- GNUNET_free (keys);
- GNUNET_free (section);
- fail (is);
- return;
+ GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
+ section,
+ "TIP_RESERVE_PRIV_FILENAME",
+ "Failed to read private key");
+ GNUNET_free (keys);
+ GNUNET_free (section);
+ fail (is);
+ return;
}
+
+ cmd->details.admin_add_incoming.reserve_priv.eddsa_priv = *pk;
+ GNUNET_free (pk);
GNUNET_free (keys);
GNUNET_free (section);
}