Home
last modified time | relevance | path

Searched refs:jws (Results 1 – 24 of 24) sorted by relevance

/external/libwebsockets/lib/jose/jwe/
Djwe-rsa-aescbc.c53 if (jwe->jws.jwk->kty != LWS_GENCRYPTO_KTY_RSA) { in lws_jwe_encrypt_rsa_aes_cbc_hs()
54 lwsl_err("%s: unexpected kty %d\n", __func__, jwe->jws.jwk->kty); in lws_jwe_encrypt_rsa_aes_cbc_hs()
65 if (lws_jws_encode_b64_element(&jwe->jws.map_b64, LJWE_JOSE, in lws_jwe_encrypt_rsa_aes_cbc_hs()
67 jwe->jws.map.buf[LJWE_JOSE], in lws_jwe_encrypt_rsa_aes_cbc_hs()
68 jwe->jws.map.len[LJWE_JOSE])) in lws_jwe_encrypt_rsa_aes_cbc_hs()
71 if (lws_jws_alloc_element(&jwe->jws.map, LJWE_ATAG, temp + (ot - *temp_len), in lws_jwe_encrypt_rsa_aes_cbc_hs()
75 if (lws_jws_alloc_element(&jwe->jws.map, LJWE_IV, temp + (ot - *temp_len), in lws_jwe_encrypt_rsa_aes_cbc_hs()
83 if (lws_jws_dup_element(&jwe->jws.map, LJWE_EKEY, temp + (ot - *temp_len), in lws_jwe_encrypt_rsa_aes_cbc_hs()
84 temp_len, jwe->jws.map.buf[LJWE_EKEY], in lws_jwe_encrypt_rsa_aes_cbc_hs()
85 jwe->jws.map.len[LJWE_EKEY], in lws_jwe_encrypt_rsa_aes_cbc_hs()
[all …]
Djwe-rsa-aesgcm.c38 if (jwe->jws.jwk->kty != LWS_GENCRYPTO_KTY_RSA) { in lws_jwe_encrypt_rsa_aes_gcm()
39 lwsl_err("%s: wrong kty %d\n", __func__, jwe->jws.jwk->kty); in lws_jwe_encrypt_rsa_aes_gcm()
46 if (lws_jws_randomize_element(jwe->jws.context, &jwe->jws.map, LJWE_IV, in lws_jwe_encrypt_rsa_aes_gcm()
51 if (lws_jws_alloc_element(&jwe->jws.map, LJWE_ATAG, in lws_jwe_encrypt_rsa_aes_gcm()
58 if (lws_jws_encode_b64_element(&jwe->jws.map_b64, LJWE_JOSE, in lws_jwe_encrypt_rsa_aes_gcm()
60 jwe->jws.map.buf[LJWE_JOSE], in lws_jwe_encrypt_rsa_aes_gcm()
61 jwe->jws.map.len[LJWE_JOSE])) in lws_jwe_encrypt_rsa_aes_gcm()
70 if (lws_get_random(jwe->jws.context, jwe->cek, ekbytes) != in lws_jwe_encrypt_rsa_aes_gcm()
78 if (lws_jws_dup_element(&jwe->jws.map, LJWE_EKEY, in lws_jwe_encrypt_rsa_aes_gcm()
85 n = lws_jwe_encrypt_gcm(jwe, (uint8_t *)jwe->jws.map.buf[LJWE_EKEY], in lws_jwe_encrypt_rsa_aes_gcm()
[all …]
Djwe-ecdh-es-aeskw.c211 if (jwe->jws.jwk->kty != LWS_GENCRYPTO_KTY_EC) { in lws_jwe_encrypt_ecdh()
212 lwsl_err("%s: unexpected kty %d\n", __func__, jwe->jws.jwk->kty); in lws_jwe_encrypt_ecdh()
222 if (lws_genecdh_create(&ecctx, jwe->jws.context, NULL)) in lws_jwe_encrypt_ecdh()
227 jwe->jws.jwk->e[LWS_GENCRYPTO_EC_KEYEL_CRV].buf, in lws_jwe_encrypt_ecdh()
232 if (lws_genecdh_set_key(&ecctx, jwe->jws.jwk->e, LDHS_THEIRS)) { in lws_jwe_encrypt_ecdh()
296 if (lws_get_random(jwe->jws.context, cek, enc_hlen) != in lws_jwe_encrypt_ecdh()
317 (void *)jwe->jws.map.buf[LJWE_EKEY], in lws_jwe_encrypt_ecdh()
329 jwe->jws.map.len[LJWE_EKEY] = enc_hlen + 8; in lws_jwe_encrypt_ecdh()
338 jwe->jws.map.buf[LJWE_JOSE] = temp; in lws_jwe_encrypt_ecdh()
355 jwe->jws.map.len[LJWE_JOSE] = m; in lws_jwe_encrypt_ecdh()
[all …]
Djwe.c52 struct lws_jws *jws; member
106 if (!args->jws->map_b64.buf[m]) { in lws_jwe_json_cb()
107 args->jws->map_b64.buf[m] = args->temp; in lws_jwe_json_cb()
108 args->jws->map_b64.len[m] = 0; in lws_jwe_json_cb()
114 args->jws->map_b64.len[m] += ctx->npos; in lws_jwe_json_cb()
117 args->jws->map.buf[m] = args->temp; in lws_jwe_json_cb()
120 (const char *)args->jws->map_b64.buf[m], in lws_jwe_json_cb()
121 args->jws->map_b64.len[m], in lws_jwe_json_cb()
130 args->jws->map.len[m] = n; in lws_jwe_json_cb()
144 args.jws = &jwe->jws; in lws_jwe_json_parse()
[all …]
/external/libwebsockets/minimal-examples/crypto/minimal-crypto-jws/
Dmain.c28 struct lws_jws jws; in main() local
48 lws_jws_init(&jws, &jwk, context); in main()
63 if (lws_jws_alloc_element(&jws.map, LJWS_JOSE, in main()
70 jws.map.len[LJWS_JOSE] = in main()
71 lws_snprintf((char *)jws.map.buf[LJWS_JOSE], in main()
101 jws.map.buf[LJWS_PYLD] = in; in main()
102 jws.map.len[LJWS_PYLD] = n; in main()
104 if (lws_jws_encode_b64_element(&jws.map_b64, LJWS_PYLD, in main()
106 &temp_len, jws.map.buf[LJWS_PYLD], in main()
107 jws.map.len[LJWS_PYLD])) in main()
[all …]
DCMakeLists.txt1 project(lws-crypto-jws)
5 set(SAMP lws-crypto-jws)
DREADME.md47 $ echo -n "plaintext0123456" | ./lws-crypto-jws -s "ES256" -k ec-p256.private
/external/libwebsockets/lib/jose/jwe/enc/
Daescbc.c42 if (jwe->jws.map.len[LJWE_ATAG] != (unsigned int)hlen / 2) { in lws_jwe_encrypt_cbc_hs()
44 hlen / 2, jwe->jws.map.len[LJWE_ATAG]); in lws_jwe_encrypt_cbc_hs()
48 if (jwe->jws.map.len[LJWE_IV] != 16) { in lws_jwe_encrypt_cbc_hs()
50 jwe->jws.map.len[LJWE_IV]); in lws_jwe_encrypt_cbc_hs()
72 lws_get_random(jwe->jws.context, (void *)jwe->jws.map.buf[LJWE_IV], 16); in lws_jwe_encrypt_cbc_hs()
96 n = lws_genaes_crypt(&aesctx, (uint8_t *)jwe->jws.map.buf[LJWE_CTXT], in lws_jwe_encrypt_cbc_hs()
97 jwe->jws.map.len[LJWE_CTXT], in lws_jwe_encrypt_cbc_hs()
98 (uint8_t *)jwe->jws.map.buf[LJWE_CTXT], in lws_jwe_encrypt_cbc_hs()
99 (uint8_t *)jwe->jws.map.buf[LJWE_IV], in lws_jwe_encrypt_cbc_hs()
102 jwe->jws.map.len[LJWE_CTXT]); in lws_jwe_encrypt_cbc_hs()
[all …]
Daeskw.c47 if (jwe->jws.jwk->kty != LWS_GENCRYPTO_KTY_OCT) { in lws_jwe_encrypt_aeskw_cbc_hs()
48 lwsl_err("%s: unexpected kty %d\n", __func__, jwe->jws.jwk->kty); in lws_jwe_encrypt_aeskw_cbc_hs()
55 if (lws_jws_encode_b64_element(&jwe->jws.map_b64, LJWE_JOSE, in lws_jwe_encrypt_aeskw_cbc_hs()
57 jwe->jws.map.buf[LJWE_JOSE], in lws_jwe_encrypt_aeskw_cbc_hs()
58 jwe->jws.map.len[LJWE_JOSE])) in lws_jwe_encrypt_aeskw_cbc_hs()
63 if (lws_jws_alloc_element(&jwe->jws.map, LJWE_ATAG, temp + (ot - *temp_len), in lws_jwe_encrypt_aeskw_cbc_hs()
67 if (lws_jws_alloc_element(&jwe->jws.map, LJWE_IV, temp + (ot - *temp_len), in lws_jwe_encrypt_aeskw_cbc_hs()
75 n = lws_jwe_encrypt_cbc_hs(jwe, (uint8_t *)jwe->jws.map.buf[LJWE_EKEY], in lws_jwe_encrypt_aeskw_cbc_hs()
76 (uint8_t *)jwe->jws.map_b64.buf[LJWE_JOSE], in lws_jwe_encrypt_aeskw_cbc_hs()
77 jwe->jws.map_b64.len[LJWE_JOSE]); in lws_jwe_encrypt_aeskw_cbc_hs()
[all …]
Daesgcm.c64 if (jwe->jws.map.len[LJWE_ATAG] != LWS_AESGCM_TAG) { in lws_jwe_encrypt_gcm()
66 __func__, jwe->jws.map.len[LJWE_ATAG]); in lws_jwe_encrypt_gcm()
70 if (jwe->jws.map.len[LJWE_IV] != LWS_AESGCM_IV) { /* MUST be 96-bit */ in lws_jwe_encrypt_gcm()
72 jwe->jws.map.len[LJWE_IV]); in lws_jwe_encrypt_gcm()
90 (uint8_t *)jwe->jws.map.buf[LJWE_IV], in lws_jwe_encrypt_gcm()
91 (uint8_t *)jwe->jws.map.buf[LJWE_ATAG], &ivs, in lws_jwe_encrypt_gcm()
99 n = lws_genaes_crypt(&aesctx, (uint8_t *)jwe->jws.map.buf[LJWE_CTXT], in lws_jwe_encrypt_gcm()
100 jwe->jws.map.len[LJWE_CTXT], in lws_jwe_encrypt_gcm()
101 (uint8_t *)jwe->jws.map.buf[LJWE_CTXT], in lws_jwe_encrypt_gcm()
102 (uint8_t *)jwe->jws.map.buf[LJWE_IV], in lws_jwe_encrypt_gcm()
[all …]
/external/libwebsockets/minimal-examples/api-tests/api-test-jose/
Djws.c124 struct lws_jws jws; in test_jws_HS256() local
128 lws_jws_init(&jws, &jwk, context); in test_jws_HS256()
207 lws_jws_destroy(&jws); in test_jws_HS256()
221 lws_jws_destroy(&jws); in test_jws_HS256()
281 struct lws_jws jws; in test_jws_RS256() local
286 lws_jws_init(&jws, &jwk, context); in test_jws_RS256()
318 &jws.map_b64) != 3) { in test_jws_RS256()
332 if (lws_jws_b64_compact_map(in, l, &jws.map_b64) != 3) { in test_jws_RS256()
338 n = lws_jws_sign_from_b64(&jose, &jws, in test_jws_RS256()
339 (char *)jws.map_b64.buf[LJWS_SIG], in test_jws_RS256()
[all …]
Djwe.c86 &jwe.jws.map, &jwe.jws.map_b64, temp, in test_jwe_a1()
101 if (jwe.jws.map.len[LJWE_CTXT] < strlen(ex_a1_ptext) || in test_jwe_a1()
102 lws_timingsafe_bcmp(jwe.jws.map.buf[LJWE_CTXT], ex_a1_ptext, in test_jwe_a1()
106 lwsl_hexdump_notice(jwe.jws.map.buf[LJWE_CTXT], in test_jwe_a1()
107 jwe.jws.map.len[LJWE_CTXT]); in test_jwe_a1()
136 jwe.jws.map.buf[LJWS_JOSE] = temp; in test_jwe_a1()
137 jwe.jws.map.len[LJWS_JOSE] = lws_snprintf(temp, temp_len, in test_jwe_a1()
139 temp_len -= jwe.jws.map.len[LJWS_JOSE]; in test_jwe_a1()
146 if (lws_jws_dup_element(&jwe.jws.map, LJWE_CTXT, in test_jwe_a1()
156 if (lws_jws_randomize_element(context, &jwe.jws.map, LJWE_EKEY, in test_jwe_a1()
[all …]
DCMakeLists.txt6 set(SRCS main.c jwk.c jws.c jwe.c)
/external/libwebsockets/lib/jose/jws/
Djws.c57 struct lws_jws *jws; member
108 if (!args->jws->map_b64.buf[m]) { in lws_jws_json_cb()
109 args->jws->map_b64.buf[m] = args->temp; in lws_jws_json_cb()
110 args->jws->map_b64.len[m] = 0; in lws_jws_json_cb()
116 args->jws->map_b64.len[m] += ctx->npos; in lws_jws_json_cb()
119 args->jws->map.buf[m] = args->temp; in lws_jws_json_cb()
122 (const char *)args->jws->map_b64.buf[m], in lws_jws_json_cb()
123 args->jws->map_b64.len[m], in lws_jws_json_cb()
126 … lwsl_err("%s: b64 decode failed: in len %d, m %d\n", __func__, (int)args->jws->map_b64.len[m], m); in lws_jws_json_cb()
132 args->jws->map.len[m] = n; in lws_jws_json_cb()
[all …]
/external/libwebsockets/minimal-examples/crypto/minimal-crypto-jwe/
Dmain.c135 if (lws_jws_alloc_element(&jwe.jws.map, LJWS_JOSE, in main()
143 jwe.jws.map.len[LJWS_JOSE] = lws_snprintf( in main()
144 (char *)jwe.jws.map.buf[LJWS_JOSE], temp_len, in main()
179 jwe.jws.map.buf[LJWE_CTXT] = in; in main()
180 jwe.jws.map.len[LJWE_CTXT] = n; in main()
188 if (lws_jws_randomize_element(context, &jwe.jws.map, LJWE_EKEY, in main()
240 if (lws_jws_compact_decode(in, n, &jwe.jws.map, in main()
241 &jwe.jws.map_b64, in main()
266 if (write(1, jwe.jws.map.buf[LJWE_CTXT], in main()
267 jwe.jws.map.len[LJWE_CTXT]) < 0) { in main()
/external/libwebsockets/include/libwebsockets/
Dlws-jws.h86 lws_jws_init(struct lws_jws *jws, struct lws_jwk *jwk,
99 lws_jws_destroy(struct lws_jws *jws);
193 lws_jws_sign_from_b64(struct lws_jose *jose, struct lws_jws *jws, char *b64_sig,
224 struct lws_jws *jws, struct lws_jwk *jwk,
237 lws_jws_write_flattened_json(struct lws_jws *jws, char *flattened, size_t len);
248 lws_jws_write_compact(struct lws_jws *jws, char *compact, size_t len);
Dlws-jwe.h47 struct lws_jws jws; member
/external/libwebsockets/plugins/acme-client/
Dprotocol_lws_acme_client.c216 struct lws_jws jws; in jws_create_packet() local
219 lws_jws_init(&jws, &jwe->jwk, context); in jws_create_packet()
266 jws.map_b64.buf[LJWS_JOSE] = p1; in jws_create_packet()
272 jws.map_b64.len[LJWS_JOSE] = n; in jws_create_packet()
276 jws.map_b64.buf[LJWS_PYLD] = p1; in jws_create_packet()
282 jws.map_b64.len[LJWS_PYLD] = n; in jws_create_packet()
291 n = lws_jws_sign_from_b64(&jwe->jose, &jws, p1, end1 - p1); in jws_create_packet()
297 jws.map_b64.buf[LJWS_SIG] = p1; in jws_create_packet()
298 jws.map_b64.len[LJWS_SIG] = n; in jws_create_packet()
308 lws_jws_destroy(&jws); in jws_create_packet()
/external/libwebsockets/minimal-examples/crypto/
DREADME.md5 minimal-crypto-jws|Examples for lws RFC7515 JWS apis
/external/libwebsockets/READMEs/
DREADME.crypto-apis.md126 |JWS|[./include/libwebsockets/lws-jws.h](https://libwebsockets.org/git/libwebsockets/tree/include/l…
132 …ample](https://libwebsockets.org/git/libwebsockets/tree/minimal-examples/crypto/minimal-crypto-jws)
/external/libwebsockets/lib/jose/
DREADME.md71 [JWS](https://libwebsockets.org/git/libwebsockets/tree/minimal-examples/crypto/minimal-crypto-jws)
/external/libwebsockets/
DAndroid.bp140 "lib/jose/jws",
Dlibwebsockets.dox127 include/libwebsockets/lws-jws.h \
DCMakeLists.txt411 …bs/libevent lib/event-libs/glib lib/event-libs/libev lib/jose/jwe lib/jose/jws lib/jose lib/misc l…
1669 lib/jose/jws/jose.c
1670 lib/jose/jws/jws.c