Lines Matching refs:jwe

26 #include "private-lib-jose-jwe.h"
38 lws_jwe_encrypt_aeskw_cbc_hs(struct lws_jwe *jwe, char *temp, int *temp_len)
44 int n, m, hlen = (int)lws_genhmac_size(jwe->jose.enc_alg->hmac_type),
47 if (jwe->jws.jwk->kty != LWS_GENCRYPTO_KTY_OCT) {
48 lwsl_err("%s: unexpected kty %d\n", __func__, jwe->jws.jwk->kty);
55 if (lws_jws_encode_b64_element(&jwe->jws.map_b64, LJWE_JOSE,
57 jwe->jws.map.buf[LJWE_JOSE],
58 jwe->jws.map.len[LJWE_JOSE]))
63 if (lws_jws_alloc_element(&jwe->jws.map, LJWE_ATAG, temp + (ot - *temp_len),
67 if (lws_jws_alloc_element(&jwe->jws.map, LJWE_IV, temp + (ot - *temp_len),
75 n = lws_jwe_encrypt_cbc_hs(jwe, (uint8_t *)jwe->jws.map.buf[LJWE_EKEY],
76 (uint8_t *)jwe->jws.map_b64.buf[LJWE_JOSE],
77 (int)jwe->jws.map_b64.len[LJWE_JOSE]);
87 jwe->jws.jwk->e, 1, NULL)) {
95 n = lws_genaes_crypt(&aesctx, (uint8_t *)jwe->jws.map.buf[LJWE_EKEY],
96 jwe->jws.map.len[LJWE_EKEY], enc_cek, NULL, NULL, NULL,
98 jwe->jose.enc_alg->keybits_fixed));
109 jwe->jws.map.len[LJWE_EKEY] += LWS_JWE_RFC3394_OVERHEAD_BYTES;
110 memcpy((uint8_t *)jwe->jws.map.buf[LJWE_EKEY], enc_cek,
111 jwe->jws.map.len[LJWE_EKEY]);
113 return (int)jwe->jws.map.len[LJWE_CTXT];
118 lws_jwe_auth_and_decrypt_aeskw_cbc_hs(struct lws_jwe *jwe)
125 if (jwe->jws.jwk->kty != LWS_GENCRYPTO_KTY_OCT) {
126 lwsl_err("%s: unexpected kty %d\n", __func__, jwe->jws.jwk->kty);
133 if (jwe->jws.map.len[LJWE_EKEY] > sizeof(enc_cek))
139 jwe->jws.jwk->e, 1, NULL)) {
149 n = lws_genaes_crypt(&aesctx, (uint8_t *)jwe->jws.map.buf[LJWE_EKEY],
150 jwe->jws.map.len[LJWE_EKEY], enc_cek, NULL, NULL, NULL,
152 jwe->jose.enc_alg->keybits_fixed));
165 n = lws_jwe_auth_and_decrypt_cbc_hs(jwe, enc_cek,
166 (uint8_t *)jwe->jws.map_b64.buf[LJWE_JOSE],
167 (int)jwe->jws.map_b64.len[LJWE_JOSE]);
174 return (int)jwe->jws.map.len[LJWE_CTXT];