Home
last modified time | relevance | path

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

12

/third_party/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 (int)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 …]
/third_party/libwebsockets/minimal-examples/crypto/minimal-crypto-jws/
Dmain.c28 struct lws_jws jws; in main() local
50 lws_jws_init(&jws, &jwk, context); in main()
65 if (lws_jws_alloc_element(&jws.map, LJWS_JOSE, in main()
72 jws.map.len[LJWS_JOSE] = (uint32_t) in main()
73 lws_snprintf((char *)jws.map.buf[LJWS_JOSE], in main()
103 jws.map.buf[LJWS_PYLD] = in; in main()
104 jws.map.len[LJWS_PYLD] = (unsigned int)n; in main()
106 if (lws_jws_encode_b64_element(&jws.map_b64, LJWS_PYLD, in main()
108 &temp_len, jws.map.buf[LJWS_PYLD], in main()
109 jws.map.len[LJWS_PYLD])) in main()
[all …]
DCMakeLists.txt1 project(lws-crypto-jws C)
8 set(SAMP lws-crypto-jws)
DREADME.md47 $ echo -n "plaintext0123456" | ./lws-crypto-jws -s "ES256" -k ec-p256.private
/third_party/libwebsockets/lib/jose/jwe/
Djwe-rsa-aescbc.c54 if (jwe->jws.jwk->kty != LWS_GENCRYPTO_KTY_RSA) { in lws_jwe_encrypt_rsa_aes_cbc_hs()
55 lwsl_err("%s: unexpected kty %d\n", __func__, jwe->jws.jwk->kty); in lws_jwe_encrypt_rsa_aes_cbc_hs()
66 if (lws_jws_encode_b64_element(&jwe->jws.map_b64, LJWE_JOSE, in lws_jwe_encrypt_rsa_aes_cbc_hs()
68 jwe->jws.map.buf[LJWE_JOSE], in lws_jwe_encrypt_rsa_aes_cbc_hs()
69 jwe->jws.map.len[LJWE_JOSE])) in lws_jwe_encrypt_rsa_aes_cbc_hs()
72 if (lws_jws_alloc_element(&jwe->jws.map, LJWE_ATAG, temp + (ot - *temp_len), in lws_jwe_encrypt_rsa_aes_cbc_hs()
76 if (lws_jws_alloc_element(&jwe->jws.map, LJWE_IV, temp + (ot - *temp_len), in lws_jwe_encrypt_rsa_aes_cbc_hs()
84 if (lws_jws_dup_element(&jwe->jws.map, LJWE_EKEY, temp + (ot - *temp_len), in lws_jwe_encrypt_rsa_aes_cbc_hs()
85 temp_len, jwe->jws.map.buf[LJWE_EKEY], in lws_jwe_encrypt_rsa_aes_cbc_hs()
86 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, (unsigned int)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, (unsigned int)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] = (unsigned int)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] = (unsigned int)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 (int)args->jws->map_b64.len[m], in lws_jwe_json_cb()
130 args->jws->map.len[m] = (uint32_t)n; in lws_jwe_json_cb()
144 args.jws = &jwe->jws; in lws_jwe_json_parse()
[all …]
/third_party/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] = (uint32_t)lws_snprintf(temp, (unsigned int)temp_len, in test_jwe_a1()
139 temp_len -= (int)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.txt9 set(SRCS main.c jwk.c jws.c jwe.c)
/third_party/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 (int)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] = (unsigned int)n; in lws_jws_json_cb()
[all …]
/third_party/libwebsockets/minimal-examples/crypto/minimal-crypto-jwe/
Dmain.c137 if (lws_jws_alloc_element(&jwe.jws.map, LJWS_JOSE, in main()
145 jwe.jws.map.len[LJWS_JOSE] = (uint32_t)lws_snprintf( in main()
146 (char *)jwe.jws.map.buf[LJWS_JOSE], (unsigned int)temp_len, in main()
181 jwe.jws.map.buf[LJWE_CTXT] = in; in main()
182 jwe.jws.map.len[LJWE_CTXT] = (uint32_t)n; in main()
190 if (lws_jws_randomize_element(context, &jwe.jws.map, LJWE_EKEY, in main()
246 if (lws_jws_compact_decode(in, n, &jwe.jws.map, in main()
247 &jwe.jws.map_b64, in main()
272 if (write(1, jwe.jws.map.buf[LJWE_CTXT], in main()
273 jwe.jws.map.len[LJWE_CTXT]) < 0) { in main()
/third_party/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);
195 lws_jws_sign_from_b64(struct lws_jose *jose, struct lws_jws *jws, char *b64_sig,
226 struct lws_jws *jws, struct lws_jwk *jwk,
239 lws_jws_write_flattened_json(struct lws_jws *jws, char *flattened, size_t len);
250 lws_jws_write_compact(struct lws_jws *jws, char *compact, size_t len);
Dlws-jwe.h47 struct lws_jws jws; member
/third_party/libwebsockets/lib/jose/
DCMakeLists.txt25 include_directories(. ./jwe ./jws ./jwk)
29 jose/jws/jose.c
32 jose/jws/jws.c
DREADME.md71 [JWS](https://libwebsockets.org/git/libwebsockets/tree/minimal-examples/crypto/minimal-crypto-jws)
/third_party/libwebsockets/plugins/acme-client/
Dprotocol_lws_acme_client.c223 struct lws_jws jws; in jws_create_packet() local
226 lws_jws_init(&jws, &jwe->jwk, context); in jws_create_packet()
273 jws.map_b64.buf[LJWS_JOSE] = p1; in jws_create_packet()
279 jws.map_b64.len[LJWS_JOSE] = (uint32_t)n; in jws_create_packet()
283 jws.map_b64.buf[LJWS_PYLD] = p1; in jws_create_packet()
289 jws.map_b64.len[LJWS_PYLD] = (uint32_t)n; in jws_create_packet()
298 n = lws_jws_sign_from_b64(&jwe->jose, &jws, p1, lws_ptr_diff_size_t(end1, p1)); in jws_create_packet()
304 jws.map_b64.buf[LJWS_SIG] = p1; in jws_create_packet()
305 jws.map_b64.len[LJWS_SIG] = (uint32_t)n; in jws_create_packet()
315 lws_jws_destroy(&jws); in jws_create_packet()
/third_party/libwebsockets/minimal-examples/crypto/
DREADME.md5 minimal-crypto-jws|Examples for lws RFC7515 JWS apis
/third_party/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)
DREADME.jwt.md115 The related apis are in `./include/libwebsockets/lws-jws.h`
/third_party/libwebsockets/
DBUILD.gn170 "//third_party/libwebsockets/lib/jose/jws",
286 "//third_party/libwebsockets/lib/jose/jws",
Dlibwebsockets.dox134 include/libwebsockets/lws-jws.h \

12