-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ext/crypto): support importing RSA JWKs #13071
Conversation
This commit adds support for importing RSA JWKs in the Web Crypto API. Co-authored-by: Sean Michael Wykes <sean.wykes@nascent.com.br>
@@ -3948,240 +3948,120 @@ | |||
"Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-OAEP}, true, [decrypt])", | |||
"Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-OAEP}, true, [unwrapKey, decrypt])", | |||
"Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-OAEP}, true, [unwrapKey])", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests were extractable = true
do not yet pass, because they rely on support for exporting RSA private keys (which is not implemented in this PR).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM too
let hash; | ||
|
||
// 8. | ||
switch (jwk.alg) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lucacasonato I believe you need a different set of JWK.alg for each algorithm. For example, RSA-OAEP-256 for RSA-OAEP, PS256 for RSA-PSS.
See
[https://www.w3.org/TR/WebCryptoAPI/#rsa-pss-operations] .. jwk step 7, and
[https://www.w3.org/TR/WebCryptoAPI/#rsa-oaep-operations] .. jwk step 8
This commit adds support for importing RSA JWKs in the Web Crypto API.
Extracted out of #12022, with modifications.
Towards #11690