aboutsummaryrefslogtreecommitdiffstats
path: root/matrix-json.h
diff options
context:
space:
mode:
authorDr. David Alan Gilbert <dave@treblig.org>2018-02-22 22:10:04 +0000
committerDr. David Alan Gilbert <dave@treblig.org>2018-02-25 02:08:49 +0000
commitab534c13c395bdcce5115945b796821cd1e6d75f (patch)
tree78b18d4852cc0e9bc2565ce775c1523331b53161 /matrix-json.h
parent8e49e86f59739d6e9dae3072864736553f78b466 (diff)
downloadpurple-matrix-ab534c13c395bdcce5115945b796821cd1e6d75f.tar.gz
e2e: Add jws decode
JSON web signatures almost use base64 but with a slightly odd encoding; decoding a JWS to base64. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
Diffstat (limited to 'matrix-json.h')
-rw-r--r--matrix-json.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/matrix-json.h b/matrix-json.h
index 43b94aa..8aed2d1 100644
--- a/matrix-json.h
+++ b/matrix-json.h
@@ -65,6 +65,14 @@ const gchar *matrix_json_array_get_string_element(JsonArray *array,
*/
GString *matrix_canonical_json(JsonObject *object);
+/* Decode a json web signature (JWS) which is almost base64,
+ * its needs _ -> / and - -> + and some = padding.
+ * as https://tools.ietf.org/html/draft-ietf-jose-json-web-signature-41#appendix-C
+ * The output buffer should be upto 3 bytes longer than the input
+ * depending on the amount of = padding needed.
+ */
+void matrix_json_jws_tobase64(gchar *out, const gchar *in);
+
/* Just dump the Json with the string prefix for debugging */
void matrix_debug_jsonobject(const char *reason, JsonObject *object);