summaryrefslogtreecommitdiff
path: root/src/json/json_pack.c
diff options
context:
space:
mode:
authorÖzgür Kesim <oec-taler@kesim.org>2022-06-26 16:59:27 +0200
committerÖzgür Kesim <oec-taler@kesim.org>2022-06-26 16:59:27 +0200
commit31f74059e0d710254397688aabc201b230ef27da (patch)
tree8a9717ae3d729c5916db15c7407d8d68b2828f85 /src/json/json_pack.c
parentb39febe36fd66c8a36469cbedbc6197cc6c60135 (diff)
downloadexchange-31f74059e0d710254397688aabc201b230ef27da.tar.gz
exchange-31f74059e0d710254397688aabc201b230ef27da.tar.bz2
exchange-31f74059e0d710254397688aabc201b230ef27da.zip
[new /keys response] create and parse denomination implemented
- /keys response now contains signed denomintations - hashes of denominations now XOR'ed per group into a single hash-code - final hash-code is now XOR of all group hash codes - final hash-code is signed - lib/exchange_api_handle support for new "denominations" implemented - parses array of denomation groups - creates running xor of hashes - verifies signature at the end - previous diff/merge logic for keys remains intact.
Diffstat (limited to 'src/json/json_pack.c')
-rw-r--r--src/json/json_pack.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/json/json_pack.c b/src/json/json_pack.c
index 090a8b96b..bb52eeb05 100644
--- a/src/json/json_pack.c
+++ b/src/json/json_pack.c
@@ -79,35 +79,38 @@ TALER_JSON_pack_denom_pub (
struct GNUNET_JSON_PackSpec ps = {
.field_name = name,
};
+ struct GNUNET_JSON_PackSpec mask_or_end;
if (NULL == pk)
return ps;
+
+ mask_or_end = (0 != pk->age_mask.bits) ?
+ GNUNET_JSON_pack_uint64 ("age_mask", pk->age_mask.bits) :
+ GNUNET_JSON_pack_end_ ();
+
switch (pk->cipher)
{
case TALER_DENOMINATION_RSA:
ps.object
= GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("cipher",
- "RSA"),
- GNUNET_JSON_pack_uint64 ("age_mask",
- pk->age_mask.bits),
+ GNUNET_JSON_pack_string ("cipher", "RSA"),
GNUNET_JSON_pack_rsa_public_key ("rsa_public_key",
- pk->details.rsa_public_key));
+ pk->details.rsa_public_key),
+ mask_or_end);
break;
case TALER_DENOMINATION_CS:
ps.object
= GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("cipher",
- "CS"),
- GNUNET_JSON_pack_uint64 ("age_mask",
- pk->age_mask.bits),
+ GNUNET_JSON_pack_string ("cipher", "CS"),
GNUNET_JSON_pack_data_varsize ("cs_public_key",
&pk->details.cs_public_key,
- sizeof (pk->details.cs_public_key)));
+ sizeof (pk->details.cs_public_key)),
+ mask_or_end);
break;
default:
GNUNET_assert (0);
}
+
return ps;
}