/third_party/libwebsockets/minimal-examples/api-tests/api-test-jose/ |
D | jwe.c | 72 struct lws_jwe jwe; in test_jwe_a1() local 76 lws_jwe_init(&jwe, context); in test_jwe_a1() 78 if (lws_jwk_import(&jwe.jwk, NULL, NULL, ex_a1_jwk_json, in test_jwe_a1() 86 &jwe.jws.map, &jwe.jws.map_b64, temp, in test_jwe_a1() 92 n = lws_jwe_auth_and_decrypt(&jwe, lws_concat_temp(temp, temp_len), 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() 115 lws_jwe_destroy(&jwe); in test_jwe_a1() [all …]
|
D | CMakeLists.txt | 9 set(SRCS main.c jwk.c jws.c jwe.c)
|
/third_party/libwebsockets/lib/jose/jwe/ |
D | jwe-rsa-aesgcm.c | 32 lws_jwe_encrypt_rsa_aes_gcm(struct lws_jwe *jwe, char *temp, int *temp_len) in lws_jwe_encrypt_rsa_aes_gcm() argument 34 int ekbytes = jwe->jose.enc_alg->keybits_fixed / 8; in lws_jwe_encrypt_rsa_aes_gcm() 38 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() 69 if (!jwe->cek_valid) { in lws_jwe_encrypt_rsa_aes_gcm() [all …]
|
D | jwe.c | 137 lws_jwe_json_parse(struct lws_jwe *jwe, const uint8_t *buf, int len, in lws_jwe_json_parse() argument 144 args.jws = &jwe->jws; in lws_jwe_json_parse() 162 lws_jwe_init(struct lws_jwe *jwe, struct lws_context *context) in lws_jwe_init() argument 164 lws_jose_init(&jwe->jose); in lws_jwe_init() 165 lws_jws_init(&jwe->jws, &jwe->jwk, context); in lws_jwe_init() 166 memset(&jwe->jwk, 0, sizeof(jwe->jwk)); in lws_jwe_init() 167 jwe->recip = 0; in lws_jwe_init() 168 jwe->cek_valid = 0; in lws_jwe_init() 172 lws_jwe_destroy(struct lws_jwe *jwe) in lws_jwe_destroy() argument 174 lws_jws_destroy(&jwe->jws); in lws_jwe_destroy() [all …]
|
D | jwe-rsa-aescbc.c | 46 lws_jwe_encrypt_rsa_aes_cbc_hs(struct lws_jwe *jwe, in lws_jwe_encrypt_rsa_aes_cbc_hs() argument 49 int n, hlen = (int)lws_genhmac_size(jwe->jose.enc_alg->hmac_type), in lws_jwe_encrypt_rsa_aes_cbc_hs() 54 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() [all …]
|
D | jwe-ecdh-es-aeskw.c | 199 lws_jwe_encrypt_ecdh(struct lws_jwe *jwe, char *temp, int *temp_len, in lws_jwe_encrypt_ecdh() argument 206 enc_hlen = (int)lws_genhmac_size(jwe->jose.enc_alg->hmac_type), in lws_jwe_encrypt_ecdh() 209 struct lws_jwk *ephem = &jwe->jose.recipient[jwe->recip].jwk_ephemeral; in lws_jwe_encrypt_ecdh() 211 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() 266 if (lws_jwa_concat_kdf(jwe, in lws_jwe_encrypt_ecdh() 267 jwe->jose.alg->algtype_crypto == LWS_JOSE_ENCTYPE_NONE, in lws_jwe_encrypt_ecdh() [all …]
|
D | private-lib-jose-jwe.h | 31 lws_jwe_auth_and_decrypt_rsa_aes_cbc_hs(struct lws_jwe *jwe); 35 lws_jwe_encrypt_rsa_aes_cbc_hs(struct lws_jwe *jwe, 39 lws_jwe_auth_and_decrypt_cbc_hs(struct lws_jwe *jwe, uint8_t *enc_cek, 46 lws_jwe_auth_and_decrypt_gcm(struct lws_jwe *jwe, uint8_t *enc_cek, 50 lws_jwe_auth_and_decrypt_rsa_aes_gcm(struct lws_jwe *jwe); 53 lws_jwe_encrypt_gcm(struct lws_jwe *jwe, 57 lws_jwe_encrypt_rsa_aes_gcm(struct lws_jwe *jwe, 66 lws_jwe_encrypt_aeskw_cbc_hs(struct lws_jwe *jwe, 70 lws_jwe_auth_and_decrypt_aeskw_cbc_hs(struct lws_jwe *jwe); 75 lws_jwe_auth_and_decrypt_cbc_hs(struct lws_jwe *jwe, uint8_t *enc_cek, [all …]
|
/third_party/libwebsockets/lib/jose/jwe/enc/ |
D | aescbc.c | 29 lws_jwe_encrypt_cbc_hs(struct lws_jwe *jwe, uint8_t *cek, in lws_jwe_encrypt_cbc_hs() argument 32 int n, hlen = (int)lws_genhmac_size(jwe->jose.enc_alg->hmac_type); in lws_jwe_encrypt_cbc_hs() 42 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() [all …]
|
D | aeskw.c | 38 lws_jwe_encrypt_aeskw_cbc_hs(struct lws_jwe *jwe, char *temp, int *temp_len) in lws_jwe_encrypt_aeskw_cbc_hs() argument 44 int n, m, hlen = (int)lws_genhmac_size(jwe->jose.enc_alg->hmac_type), in lws_jwe_encrypt_aeskw_cbc_hs() 47 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() [all …]
|
D | aesgcm.c | 53 lws_jwe_encrypt_gcm(struct lws_jwe *jwe, in lws_jwe_encrypt_gcm() argument 64 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() 78 el.len = jwe->jose.enc_alg->keybits_fixed / 8; 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() [all …]
|
/third_party/libwebsockets/minimal-examples/crypto/minimal-crypto-jwe/ |
D | main.c | 90 struct lws_jwe jwe; in main() local 111 lws_jwe_init(&jwe, context); in main() 126 if (lws_gencrypto_jwe_alg_to_definition(p, &jwe.jose.alg)) { in main() 130 if (lws_gencrypto_jwe_enc_to_definition(sp + 1, &jwe.jose.enc_alg)) { in main() 137 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() 166 if (lws_jwk_load(&jwe.jwk, p, NULL, NULL)) { in main() 181 jwe.jws.map.buf[LJWE_CTXT] = in; in main() 182 jwe.jws.map.len[LJWE_CTXT] = (uint32_t)n; in main() [all …]
|
D | CMakeLists.txt | 1 project(lws-crypto-jwe C) 8 set(SAMP lws-crypto-jwe)
|
D | README.md | 53 $ echo -n "plaintext0123456" | ./lws-crypto-jwe -k key-rsa-4096.private -e "RSA1_5 A128CBC-HS256" 66 ./lws-crypto-jwe -k key-rsa-4096.pub -e "RSA1_5 A128CBC-HS256" | \ 67 ./lws-crypto-jwe -k key-rsa-4096.private
|
/third_party/libwebsockets/include/libwebsockets/ |
D | lws-jwe.h | 61 lws_jwe_init(struct lws_jwe *jwe, struct lws_context *context); 64 lws_jwe_destroy(struct lws_jwe *jwe); 80 lws_jwe_render_compact(struct lws_jwe *jwe, char *out, size_t out_len); 83 lws_jwe_render_flattened(struct lws_jwe *jwe, char *out, size_t out_len); 86 lws_jwe_json_parse(struct lws_jwe *jwe, const uint8_t *buf, int len, 113 lws_jwe_auth_and_decrypt(struct lws_jwe *jwe, char *temp, int *temp_len); 129 lws_jwe_encrypt(struct lws_jwe *jwe, char *temp, int *temp_len); 151 lws_jwe_create_packet(struct lws_jwe *jwe, 158 lws_jwe_auth_and_decrypt_cbc_hs(struct lws_jwe *jwe, uint8_t *enc_cek, 163 lws_jwa_concat_kdf(struct lws_jwe *jwe, int direct,
|
/third_party/libwebsockets/lib/jose/ |
D | CMakeLists.txt | 25 include_directories(. ./jwe ./jws ./jwk) 33 jose/jwe/jwe.c 34 jose/jwe/enc/aescbc.c 35 jose/jwe/enc/aesgcm.c 36 jose/jwe/enc/aeskw.c 37 jose/jwe/jwe-rsa-aescbc.c 38 jose/jwe/jwe-rsa-aesgcm.c 39 jose/jwe/jwe-ecdh-es-aeskw.c
|
D | README.md | 73 [JWE](https://libwebsockets.org/git/libwebsockets/tree/minimal-examples/crypto/minimal-crypto-jwe)
|
/third_party/libwebsockets/plugins/acme-client/ |
D | protocol_lws_acme_client.c | 218 jws_create_packet(struct lws_jwe *jwe, const char *payload, size_t len, in jws_create_packet() argument 226 lws_jws_init(&jws, &jwe->jwk, context); in jws_create_packet() 247 if (!jwe->jose.alg || !jwe->jose.alg->alg) in jws_create_packet() 256 n = lws_jwk_export(&jwe->jwk, 0, p, &m); 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() 787 struct lws_jwe jwe; in callback_acme_client() local 794 lws_jwe_init(&jwe, lws_get_context(wsi)); in callback_acme_client() 1068 &jwe.jose.alg)) { in callback_acme_client() 1073 jwe.jwk = vhd->jwk; in callback_acme_client() 1075 ac->len = jws_create_packet(&jwe, in callback_acme_client()
|
/third_party/libwebsockets/minimal-examples/crypto/ |
D | README.md | 3 minimal-crypto-jwe|Examples for lws RFC7516 JWE apis
|
/third_party/libwebsockets/READMEs/ |
D | README.crypto-apis.md | 125 |JWE|[./include/libwebsockets/lws-jwe.h](https://libwebsockets.org/git/libwebsockets/tree/include/l… 133 …ample](https://libwebsockets.org/git/libwebsockets/tree/minimal-examples/crypto/minimal-crypto-jwe)
|
/third_party/libwebsockets/ |
D | BUILD.gn | 156 "//third_party/libwebsockets/lib/jose/jwe", 157 "//third_party/libwebsockets/lib/jose/jwe/enc", 260 "//third_party/libwebsockets/lib/jose/jwe",
|
D | libwebsockets.dox | 132 include/libwebsockets/lws-jwe.h \
|
/third_party/chromium/patch/ |
D | 0001-cve.patch | 56378 z?Y>}bJrdZnT@g64J&w1yJ)N-Fo=Z4vFCoO+b%fvc+U+gdySEQ*AKN||xDv$jwe=MQ
|