Skip to content

Commit 92e8ef1

Browse files
rootsarroutbi
root
authored andcommitted
Fix EC (Elliptic-Curve) encryption
1 parent 76924de commit 92e8ef1

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/jwe.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ find_alg(jose_cfg_t *cfg, json_t *jwe, json_t *rcp, const json_t *hdr,
147147

148148
alg = jose_hook_alg_find(JOSE_HOOK_ALG_KIND_WRAP, name);
149149
if (alg) {
150-
h = json_object_get(rcp, "header");
151-
if (!h && json_object_set_new(rcp, "header", h = json_object()) < 0)
150+
h = json_object_get(rcp, "protected");
151+
if (!h && json_object_set_new(rcp, "protected", h = json_object()) < 0)
152152
return NULL;
153153

154154
if (json_object_set_new(h, "alg", json_string(alg->name)) < 0)

lib/openssl/ecdhes.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,8 @@ alg_wrap_wrp(const jose_hook_alg_t *alg, jose_cfg_t *cfg, json_t *jwe,
357357
if (!hdr)
358358
return false;
359359

360-
h = json_object_get(rcp, "header");
361-
if (!h && json_object_set_new(rcp, "header", h = json_object()) == -1)
360+
h = json_object_get(rcp, "protected");
361+
if (!h && json_object_set_new(rcp, "protected", h = json_object()) == -1)
362362
return false;
363363

364364
epk = json_pack("{s:s,s:O}", "kty", "EC", "crv",
@@ -401,7 +401,7 @@ alg_wrap_wrp(const jose_hook_alg_t *alg, jose_cfg_t *cfg, json_t *jwe,
401401
if (json_object_update(cek, der) < 0)
402402
return false;
403403

404-
return add_entity(jwe, rcp, "recipients", "header", "encrypted_key", NULL);
404+
return add_entity(jwe, rcp, "recipients", "protected", "header", "encrypted_key", NULL);
405405
}
406406

407407
static bool

0 commit comments

Comments
 (0)