gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated: fixed json


From: gnunet
Subject: [taler-anastasis] branch master updated: fixed json
Date: Wed, 29 Apr 2020 10:55:56 +0200

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

ds-meister pushed a commit to branch master
in repository anastasis.

The following commit(s) were added to refs/heads/master by this push:
     new f7c3eac  fixed json
f7c3eac is described below

commit f7c3eacc94cffe85d4b220bb2a5f53663557fc9d
Author: Dominik Meister <address@hidden>
AuthorDate: Wed Apr 29 10:55:46 2020 +0200

    fixed json
---
 src/lib/anastasis.c | 60 +++++++++++++++++++++++++++++++----------------------
 1 file changed, 35 insertions(+), 25 deletions(-)

diff --git a/src/lib/anastasis.c b/src/lib/anastasis.c
index 58dc653..0a42a92 100644
--- a/src/lib/anastasis.c
+++ b/src/lib/anastasis.c
@@ -374,21 +374,14 @@ ANASTASIS_recovery_begin (const json_t *id_data,
   GNUNET_assert (0 ==
                  json_unpack (recovery_document,
                               "{s:o," /* policies */
-                              " s:i," /* policies length */
                               " s:o," /* decryption policies */
-                              " s:i," /* decryption policies length */
                               " s:o," /* encrypted core secret */
-                              " s:i}",/* encrypted core secret size */
                               "policies", dec_policies,
-                              "policies_length", &ri->dps_len,
                               "escrow_methods", esc_methods,
-                              "escrow_methods_length", &ri->cs_len,
-                              "core_secret", r->enc_core_secret,
-                              "core_secret_size", &r->enc_core_secret_size));
-
-
-
+                              "core_secret", r->enc_core_secret));
 
+  ri->cs_len = json_array_size (esc_methods);
+  ri->dps_len = json_array_size (dec_policies);
   struct ANASTASIS_Challenge cs[ri->cs_len];
   struct ANASTASIS_DecryptionPolicy dps[ri->dps_len];
 
@@ -1100,6 +1093,7 @@ ANASTASIS_secret_share (const json_t *id_data,
   // Recovery document contains the array decryption policies and the array 
escrow methods
   json_t *recovery_document;
   size_t recovery_document_size;
+  char *recovery_document_str;
   // json array
   json_t *dec_policies;
   // json array
@@ -1118,7 +1112,6 @@ ANASTASIS_secret_share (const json_t *id_data,
                                         encrypted_master_keys);
 
   dec_policies = json_array ();
-  esc_methods = json_array ();
   for (unsigned int k = 0; k < policies_len; k++ )
   {
     json_t *dec_policy = json_pack ("{s:o," /* encrypted master key */
@@ -1133,10 +1126,19 @@ ANASTASIS_secret_share (const json_t *id_data,
                                                            uuid_length
                                                            * sizeof(uuid_t)),
                                     "uuid_length", &policies[k]->uuid_length);
+    GNUNET_assert (NULL != dec_policy);
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "dec policy json before upload 0: %s\n",
+                json_dumps (dec_policy, JSON_COMPACT));
 
-    json_array_append_new (dec_policies, dec_policy);
+    GNUNET_assert (0 ==
+                   json_array_append_new (dec_policies, dec_policy));
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Dec policies json append before upload 0: %s\n",
+                json_dumps (dec_policies, JSON_COMPACT));
   }
   // FIXME CHALLENGE
+  esc_methods = json_array ();
   for (unsigned int l = 0; l < truths_len; l++)
   {
     // creates a json array for saving
@@ -1154,7 +1156,16 @@ ANASTASIS_secret_share (const json_t *id_data,
                                     "salt", GNUNET_JSON_from_data_auto (
                                       truths[l]->salt),
                                     "escrow_method", truths[l]->method);
-    json_array_append_new (esc_methods, esc_method);
+
+    GNUNET_assert (NULL != esc_method);
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "esc method json before upload 0: %s\n",
+                json_dumps (esc_method, JSON_COMPACT));
+    GNUNET_assert (0 ==
+                   json_array_append_new (esc_methods, esc_method));
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Esc methods json append before upload 0: %s\n",
+                json_dumps (esc_methods, JSON_COMPACT));
     // prepares policy store operation
     ss->pss[l]->anastasis_url = truths[l]->url;
     ss->pss[l]->prev_hash = *last_etag;
@@ -1162,21 +1173,20 @@ ANASTASIS_secret_share (const json_t *id_data,
 
   recovery_document = json_pack (
     "{s:o," /* policies */
-    " s:i," /* policies length */
     " s:o," /* decryption policies */
-    " s:i," /* decryption policies length */
-    " s:o," /* encrypted core secret */
-    " s:i}",/* encrypted core secret size */
+    " s:o}", /* encrypted core secret */
     "policies", dec_policies,
-    "policies_length", &policies_len,
     "escrow_methods", esc_methods,
-    "escrow_methods_length", &truths_len,
     "core_secret", GNUNET_JSON_from_data (&encrypted_core_secret,
-                                          core_secret_size),
-    "core_secret_size", &core_secret_size);
-
-  // FIXME COMPRESSION AND SIZE
+                                          core_secret_size));
+  GNUNET_assert (NULL != recovery_document);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "recovery document json before upload 0: %s\n",
+              json_dumps (recovery_document, JSON_COMPACT));
 
+  // FIXME COMPRESSION
+  recovery_document_str = json_dumps (recovery_document, JSON_COMPACT);
+  recovery_document_size = strlen (recovery_document_str);
   for (unsigned int l = 0; l < truths_len; l++)
   {
     ss->pss[l]->http_status = MHD_HTTP_NO_CONTENT;
@@ -1195,8 +1205,8 @@ ANASTASIS_secret_share (const json_t *id_data,
                                                  &ss->pss[l]->anastasis_priv);
 
     ANASTASIS_CRYPTO_recovery_document_encrypt (&ss->pss[l]->id,
-                                                recovery_document,
-                                                sizeof(recovery_document), // 
FIXME!!!
+                                                recovery_document_str,
+                                                recovery_document_size,
                                                 &ss->pss[l]->recovery_data,
                                                 
&ss->pss[l]->recovery_data_size);
 

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



reply via email to

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