Lines Matching refs:jwk
123 struct lws_jwk jwk;
128 lws_jws_init(&jws, &jwk, context);
148 if (lws_jwk_import(&jwk, NULL, NULL, key_jwk, strlen(key_jwk)) < 0) {
152 if (jwk.kty != LWS_GENCRYPTO_KTY_OCT) {
153 lwsl_err("%s: unexpected kty %d\n", __func__, jwk.kty);
180 jwk.e[LWS_GENCRYPTO_OCT_KEYEL_K].buf,
181 jwk.e[LWS_GENCRYPTO_OCT_KEYEL_K].len))
201 if (lws_jws_sig_confirm_compact_b64(buf, lws_ptr_diff_size_t(p, buf), &map, &jwk, context,
208 lws_jwk_destroy(&jwk);
222 lws_jwk_destroy(&jwk);
280 struct lws_jwk jwk;
286 lws_jws_init(&jws, &jwk, context);
295 /* 2.1: import the jwk */
297 if (lws_jwk_import(&jwk, NULL, NULL,
303 if (jwk.kty != LWS_GENCRYPTO_KTY_RSA) {
304 lwsl_err("%s: 2.2: kty: %d instead of RSA\n", __func__, jwk.kty);
312 &jwk, context, temp, &temp_len) < 0) {
350 if (lws_jws_sig_confirm_compact_b64(in, (unsigned int)l, &map, &jwk,
356 lws_jwk_destroy(&jwk);
365 lws_jwk_destroy(&jwk);
415 struct lws_jwk jwk;
462 jws.jwk = &jwk;
465 /* import the ES256 jwk */
466 if (lws_jwk_import(&jwk, NULL, NULL, es256_jwk, strlen(es256_jwk))) {
472 if (jwk.kty != LWS_GENCRYPTO_KTY_EC) {
474 __func__, jwk.kty);
478 if (lws_jws_sig_confirm(&jws.map_b64, &jws.map, &jwk, context) < 0) {
527 if (lws_jws_sig_confirm_compact_b64(p, (unsigned int)l, &map, &jwk,
537 lws_jwk_destroy(&jwk);
577 struct lws_jwk jwk;
624 jws.jwk = &jwk;
627 /* import the es512 jwk */
628 if (lws_jwk_import(&jwk, NULL, NULL, es512_jwk, strlen(es512_jwk))) {
634 if (jwk.kty != LWS_GENCRYPTO_KTY_EC) {
636 __func__, jwk.kty);
640 if (lws_jws_sig_confirm(&jws.map_b64, &jws.map, &jwk, context) < 0) {
684 if (lws_jws_sig_confirm_compact_b64(p, (unsigned int)l, &map, &jwk, context,
697 if (lws_jwt_sign_compact(context, &jwk, "ES512",
714 if (lws_jwt_signed_validate(context, &jwk, "ES512",
731 lws_jwk_destroy(&jwk);
831 struct lws_jwk jwk;
851 if (lws_x509_public_to_jwk(&jwk, pub, NULL, 2048)) {
852 lwsl_err("%s: failed to copy public key to jwk\n", __func__);
856 if (lws_x509_jwk_privkey_pem(context, &jwk, (char *)rsa_key,
858 lwsl_err("%s: failed to copy private key to jwk\n", __func__);
908 if (lws_jwt_sign_via_info(context, &jwk, &info,
923 if (lws_jwt_signed_validate(context, &jwk, "RS256",
940 lws_jwk_destroy(&jwk);