diff --git a/src/jwe.c b/src/jwe.c index 9c0d017..29f08ca 100644 --- a/src/jwe.c +++ b/src/jwe.c @@ -210,7 +210,7 @@ static bool _cjose_jwe_malloc(size_t bytes, bool random, uint8_t **buffer, cjose static bool _cjose_jwe_build_hdr(cjose_jwe_t *jwe, cjose_err *err) { // serialize the header - char *hdr_str = json_dumps(jwe->hdr, JSON_ENCODE_ANY | JSON_PRESERVE_ORDER); + char *hdr_str = json_dumps(jwe->hdr, JSON_ENCODE_ANY | JSON_PRESERVE_ORDER | JSON_COMPACT); if (NULL == hdr_str) { CJOSE_ERROR(err, CJOSE_ERR_NO_MEMORY); diff --git a/src/jws.c b/src/jws.c index 88038e4..5a117eb 100644 --- a/src/jws.c +++ b/src/jws.c @@ -51,7 +51,7 @@ static bool _cjose_jws_build_hdr(cjose_jws_t *jws, cjose_header_t *header, cjose json_incref(jws->hdr); // base64url encode the header - char *hdr_str = json_dumps(jws->hdr, JSON_ENCODE_ANY | JSON_PRESERVE_ORDER); + char *hdr_str = json_dumps(jws->hdr, JSON_ENCODE_ANY | JSON_PRESERVE_ORDER | JSON_COMPACT); if (NULL == hdr_str) { CJOSE_ERROR(err, CJOSE_ERR_NO_MEMORY);