WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
260430
[WebCrypto] Import key in jwk format should throw DataError instead of TypeError
https://bugs.webkit.org/show_bug.cgi?id=260430
Summary
[WebCrypto] Import key in jwk format should throw DataError instead of TypeError
Javier Fernandez
Reported
2023-08-19 07:10:17 PDT
This bug affects the recently added algorithm Ed25519, but also other algorithms. In the case of the former one, according to the Secure Curves spec [1], if the kty field is not present or incorrect, we should throw a DataError exception.
> If the kty field of jwk is not "OKP", then throw a DataError.
On the other hand, the Web Cryptography specification states something similar for other algorithms: * In case of the RSA-* [2][3][4] algorithms:
> If the "kty" field of jwk is not a case-sensitive string match to "RSA", then throw a DataError.
* In case of the EC* [5][6] algorithms:
> If the "kty" field of jwk is not "EC", then throw a DataError.
* In case of the AES-* [7][8][9][10] algorithms:
> If the "kty" field of jwk is not "oct", then throw a DataError.
* In case of the HMAC [11] algorithm:
> If the "kty" field of jwk is not "oct", then throw a DataError.
[1]
https://wicg.github.io/webcrypto-secure-curves/#ed25519-operations
[2]
https://www.w3.org/TR/WebCryptoAPI/#rsassa-pkcs1-operations
[3]
https://www.w3.org/TR/WebCryptoAPI/#rsa-pss-operations
[4]
https://www.w3.org/TR/WebCryptoAPI/#rsa-oaep-operations
[5]
https://www.w3.org/TR/WebCryptoAPI/#ecdsa-operations
[6]
https://www.w3.org/TR/WebCryptoAPI/#ecdh-operations
[7]
https://www.w3.org/TR/WebCryptoAPI/#aes-ctr-operations
[8]
https://www.w3.org/TR/WebCryptoAPI/#aes-cbc-operations
[9]
https://www.w3.org/TR/WebCryptoAPI/#aes-gcm-operations
[10]
https://www.w3.org/TR/WebCryptoAPI/#aes-kw-operations
[11]
https://www.w3.org/TR/WebCryptoAPI/#hmac-operations
Attachments
Add attachment
proposed patch, testcase, etc.
Javier Fernandez
Comment 1
2023-08-19 16:29:15 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/16869
EWS
Comment 2
2023-08-22 06:57:15 PDT
Committed
267131@main
(58f6c8c90849): <
https://commits.webkit.org/267131@main
> Reviewed commits have been landed. Closing PR #16869 and removing active labels.
Radar WebKit Bug Importer
Comment 3
2023-08-22 06:58:15 PDT
<
rdar://problem/114256855
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug