[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] 09/15: fix key share decryption
From: |
gnunet |
Subject: |
[taler-anastasis] 09/15: fix key share decryption |
Date: |
Sun, 31 Jan 2021 17:06:15 +0100 |
This is an automated email from the git hooks/post-receive script.
dennis-neufeld pushed a commit to branch master
in repository anastasis.
commit 9446ef21a9b78b69b844cb78568c68e3b60abc0e
Author: Dennis Neufeld <dennis.neufeld@students.bfh.ch>
AuthorDate: Tue Jan 19 20:38:17 2021 +0100
fix key share decryption
---
...astasis_reducer_backup_enter_user_attributes.sh | 2 +-
...tasis_reducer_recovery_enter_user_attributes.sh | 2 +-
src/lib/anastasis.c | 58 +++++-----------------
3 files changed, 14 insertions(+), 48 deletions(-)
diff --git a/src/cli/test_anastasis_reducer_backup_enter_user_attributes.sh
b/src/cli/test_anastasis_reducer_backup_enter_user_attributes.sh
index a4116b5..ce4d63a 100755
--- a/src/cli/test_anastasis_reducer_backup_enter_user_attributes.sh
+++ b/src/cli/test_anastasis_reducer_backup_enter_user_attributes.sh
@@ -49,7 +49,7 @@ echo "Test user attributes collection in a backup state"
'{"identity_attributes": {
"full_name": "Max Musterman",
"ahv_number": "756.9217.0769.85",
- "birth_year": 2000 ,
+ "birth_year": 2000,
"birth_month": 1,
"birth_day": 1}}' \
enter_user_attributes $SFILE $TFILE
diff --git a/src/cli/test_anastasis_reducer_recovery_enter_user_attributes.sh
b/src/cli/test_anastasis_reducer_recovery_enter_user_attributes.sh
index 32f5f43..604a6c2 100755
--- a/src/cli/test_anastasis_reducer_recovery_enter_user_attributes.sh
+++ b/src/cli/test_anastasis_reducer_recovery_enter_user_attributes.sh
@@ -121,7 +121,7 @@ echo "Test user attributes collection in a recovery state"
'{"identity_attributes": {
"full_name": "Max Musterman",
"ahv_number": "756.9217.0769.85",
- "birth_year": 2000 ,
+ "birth_year": 2000,
"birth_month": 1,
"birth_day": 1}}' \
enter_user_attributes $SFILE $TFILE
diff --git a/src/lib/anastasis.c b/src/lib/anastasis.c
index 5ebc080..a202412 100644
--- a/src/lib/anastasis.c
+++ b/src/lib/anastasis.c
@@ -121,6 +121,11 @@ struct ANASTASIS_Recovery
* Recovery information which is sent to the user
*/
struct ANASTASIS_RecoveryInformation *ri;
+
+ /**
+ * Identity data to user id from.
+ */
+ const json_t *id_data;
};
@@ -300,9 +305,12 @@ keyshare_lookup_cb (void *cls,
http_status);
return;
}
-
+ struct ANASTASIS_CRYPTO_UserIdentifierP id;
+ ANASTASIS_CRYPTO_user_identifier_derive (c->recovery->id_data,
+ &c->truth_salt,
+ &id);
ANASTASIS_CRYPTO_keyshare_decrypt (dd->encrypted_key_share,
- &c->recovery->id,
+ &id,
&c->key_share);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"At %s:%d decrypted keyshare is %s-%llu b\n", __FILE__, __LINE__,
@@ -375,7 +383,6 @@ keyshare_lookup_cb (void *cls,
TALER_B2S (&key_shares[l]),
(unsigned long long) sizeof (c->key_share),
l);
-
}
}
}
@@ -815,7 +822,6 @@ policy_lookup_cb (void *cls,
for (unsigned int j = 0; j < r->ri->dps_len; j++)
{
- // const char *nonces;
size_t n_index;
json_t *nonces;
json_t *nonce;
@@ -823,8 +829,6 @@ policy_lookup_cb (void *cls,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("master_key",
&r->ri->dps[j].emk),
- // GNUNET_JSON_spec_string ("nonces",
- // &nonces),
GNUNET_JSON_spec_fixed_auto ("salt",
&r->ri->dps[j].salt),
GNUNET_JSON_spec_uint32 ("nonces_length",
@@ -861,26 +865,6 @@ policy_lookup_cb (void *cls,
TALER_B2S (&r->ri->dps[j].nonces[n_index]),
(unsigned long long) sizeof (r->ri->dps[j].nonces[n_index]));
}
- // for (int a = 0; a < r->ri->dps[j].nonces_length; a++)
- // {
-
- // char buf[53];
-
- // GNUNET_strlcpy (buf,
- // nonces + a * 52,
- // 52);
- // GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- // "At %s:%d buf is %s\n", __FILE__, __LINE__,
- // buf);
- // GNUNET_STRINGS_string_to_data (buf,
- // sizeof (buf),
- // &r->ri->dps[j].nonces[a],
- // sizeof (struct
ANASTASIS_CRYPTO_NonceP));
- // GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- // "At %s:%d escrow nonce is %s-%llu b\n", __FILE__,
__LINE__,
- // TALER_B2S (&r->ri->dps[j].nonces[a]),
- // (unsigned long long) sizeof (r->ri->dps[j].nonces[a]));
- // }
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"At %s:%d encrypted master key is %s-%llu b\n", __FILE__,
@@ -939,6 +923,7 @@ ANASTASIS_recovery_begin (struct GNUNET_CURL_Context *ctx,
r->pc = pc;
r->pc_cls = pc_cls;
r->ctx = ctx;
+ r->id_data = id_data;
r->http_status = MHD_HTTP_OK;
ANASTASIS_CRYPTO_user_identifier_derive (id_data,
salt,
@@ -1997,33 +1982,14 @@ ANASTASIS_secret_share (struct GNUNET_CURL_Context *ctx,
__FILE__,
__LINE__,
TALER_B2S (&policy->policy_key));
- // FIXME: create 'nonces = json_array()' and
- // simply append GNUNET_JSON_from_data_auto(&policy->nonces[b]) to
- // that array, keep the JSON structured!
- // char nonces[52 * policy->nonces_length + 1];
json_t *nonces = json_array ();
for (unsigned int b = 0; b < policy->nonces_length; b++)
{
json_array_append (nonces,
GNUNET_JSON_from_data_auto (&policy->nonces[b]));
- // char *nonce_str;
- // nonce_str = GNUNET_STRINGS_data_to_string_alloc (&policy->nonces[b],
- // sizeof (policy->
- // nonces[b]));
- // GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- // "nonce is: %s\n",
- // nonce_str);
- // GNUNET_strlcpy (nonces + b * strlen (nonce_str),
- // nonce_str,
- // strlen (nonce_str));
- // GNUNET_free (nonce_str);
}
- // nonces[52 * policy->nonces_length] = '\0';
- // GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- // "At %s:%d nonces are %s b\n", __FILE__, __LINE__,
- // nonces);
if (0 !=
json_array_append_new (
dec_policies,
@@ -2035,7 +2001,7 @@ ANASTASIS_secret_share (struct GNUNET_CURL_Context *ctx,
GNUNET_JSON_from_data_auto (
&encrypted_master_keys[k]),
"nonces",
- nonces, // FIXME: turn into JSON array!
+ nonces,
"salt",
GNUNET_JSON_from_data_auto (&policy->salt),
"nonces_length",
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-anastasis] branch master updated (529012a -> fea0fc4), gnunet, 2021/01/31
- [taler-anastasis] 03/15: visualization, gnunet, 2021/01/31
- [taler-anastasis] 05/15: fix curl fini error, gnunet, 2021/01/31
- [taler-anastasis] 07/15: handle fail of fetching recovery information, gnunet, 2021/01/31
- [taler-anastasis] 04/15: worked on reducer, gnunet, 2021/01/31
- [taler-anastasis] 14/15: import .sql files for testing reducer recovery, gnunet, 2021/01/31
- [taler-anastasis] 09/15: fix key share decryption,
gnunet <=
- [taler-anastasis] 13/15: worked on recovery reducer, gnunet, 2021/01/31
- [taler-anastasis] 12/15: worked on recovery reducer, gnunet, 2021/01/31
- [taler-anastasis] 08/15: nonces use json array, gnunet, 2021/01/31
- [taler-anastasis] 06/15: fetch recovery information, gnunet, 2021/01/31
- [taler-anastasis] 15/15: Merge branch 'master' of ssh://git.taler.net/anastasis, gnunet, 2021/01/31
- [taler-anastasis] 01/15: set state to CHALLENGE_SELECTING, gnunet, 2021/01/31
- [taler-anastasis] 02/15: worked on recovery redux, gnunet, 2021/01/31
- [taler-anastasis] 10/15: fix memory leak, gnunet, 2021/01/31
- [taler-anastasis] 11/15: worked on challenge select, gnunet, 2021/01/31