diff options
author | Schanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de> | 2018-07-21 09:21:01 +0200 |
---|---|---|
committer | Schanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de> | 2018-07-21 09:21:01 +0200 |
commit | 8b5994b08ab970ba291b1d39847d0284cd9b323e (patch) | |
tree | 0ad5a07f371978eac05eda25df4d918e31c548d0 /src/reclaim | |
parent | 2371a7547d958c640b97ed6016160a5d7dde0326 (diff) | |
download | gnunet-8b5994b08ab970ba291b1d39847d0284cd9b323e.tar.gz gnunet-8b5994b08ab970ba291b1d39847d0284cd9b323e.zip |
compact JWT serialization
Diffstat (limited to 'src/reclaim')
-rw-r--r-- | src/reclaim/jwt.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/reclaim/jwt.c b/src/reclaim/jwt.c index d23c6a2a9..d9c2447bc 100644 --- a/src/reclaim/jwt.c +++ b/src/reclaim/jwt.c | |||
@@ -49,7 +49,7 @@ create_jwt_header(void) | |||
49 | json_object_set_new (root, JWT_ALG, json_string (JWT_ALG_VALUE)); | 49 | json_object_set_new (root, JWT_ALG, json_string (JWT_ALG_VALUE)); |
50 | json_object_set_new (root, JWT_TYP, json_string (JWT_TYP_VALUE)); | 50 | json_object_set_new (root, JWT_TYP, json_string (JWT_TYP_VALUE)); |
51 | 51 | ||
52 | json_str = json_dumps (root, JSON_INDENT(0)); | 52 | json_str = json_dumps (root, JSON_INDENT(0) | JSON_COMPACT); |
53 | json_decref (root); | 53 | json_decref (root); |
54 | return json_str; | 54 | return json_str; |
55 | } | 55 | } |
@@ -115,7 +115,7 @@ jwt_create_from_list (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key, | |||
115 | json_string (attr_val_str)); | 115 | json_string (attr_val_str)); |
116 | GNUNET_free (attr_val_str); | 116 | GNUNET_free (attr_val_str); |
117 | } | 117 | } |
118 | body_str = json_dumps (body, JSON_INDENT(0)); | 118 | body_str = json_dumps (body, JSON_INDENT(0) | JSON_COMPACT); |
119 | json_decref (body); | 119 | json_decref (body); |
120 | 120 | ||
121 | GNUNET_STRINGS_base64_encode (header, | 121 | GNUNET_STRINGS_base64_encode (header, |
@@ -147,6 +147,12 @@ jwt_create_from_list (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key, | |||
147 | GNUNET_STRINGS_base64_encode ((const char*)&signature, | 147 | GNUNET_STRINGS_base64_encode ((const char*)&signature, |
148 | sizeof (struct GNUNET_HashCode), | 148 | sizeof (struct GNUNET_HashCode), |
149 | &signature_base64); | 149 | &signature_base64); |
150 | |||
151 | //Remove GNUNET padding of base64 | ||
152 | padding = strtok(signature_base64, "="); | ||
153 | while (NULL != padding) | ||
154 | padding = strtok(NULL, "="); | ||
155 | |||
150 | GNUNET_asprintf (&result, "%s.%s.%s", | 156 | GNUNET_asprintf (&result, "%s.%s.%s", |
151 | header_base64, body_base64, signature_base64); | 157 | header_base64, body_base64, signature_base64); |
152 | 158 | ||