gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-merchant] branch master updated: changing tip_reserv


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] branch master updated: changing tip_reserve_priv to tip_reserve_priv_filename (#5188)
Date: Thu, 07 Dec 2017 07:38:46 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new 9f1ca17  changing tip_reserve_priv to tip_reserve_priv_filename (#5188)
9f1ca17 is described below

commit 9f1ca1783f92c9f4e8ad795a5329dc60f78261b5
Author: Christian Grothoff <address@hidden>
AuthorDate: Thu Dec 7 07:28:45 2017 +0100

    changing tip_reserve_priv to tip_reserve_priv_filename (#5188)
---
 doc/manual.texi                    | 25 ++++++-------------------
 src/backend/taler-merchant-httpd.c | 18 +++++++++---------
 src/lib/test_merchant_api.c        | 32 +++++++++++++++++---------------
 3 files changed, 32 insertions(+), 43 deletions(-)

diff --git a/doc/manual.texi b/doc/manual.texi
index 8b032a8..731b219 100644
--- 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
-
address@hidden
-$ gnunet-ecc --print-private-key tip.priv
address@hidden example
-
-to print out the corresponding private key.  It will look like
-this:
-
address@hidden
-QPE24X8PBX3BZ6E7GQ5VAVHV32FWTTCADR0TRQ183MSSJD2CHNEG
address@hidden 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
index 9d394ea..cc6d840 100644
--- 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
index 8fe7ac9..73c944b 100644
--- 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 (&section,
                        "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);
     }

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]