EC algorithms import operation throws DataError exception on invalid usages
Categories
(Core :: DOM: Web Crypto, defect, P5)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox133 | --- | fixed |
People
(Reporter: u738353, Assigned: anna.weine)
References
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:130.0) Gecko/20100101 Firefox/130.0
Steps to reproduce:
1- Load the following script in the console
var jwkKey = {
kty: "EC",
crv: "P-521",
x: "AVb0efjfHiCn_8BM5CDD4VSuJRmWvuQvA0uE1Bt0PzTkXzEbgTqc3sjNpZu7vTHUYLMpJSHnwbci5WZ8A9svrnU_",
y: "AVAXNs_iRzlDINjkr8L9ObWpMxBhuB4iQSgrnheJGCK1t54FL0WXtZZD_Tk3nFG9USXE9IvD8CXOPNNpUyhsyzj7",
d: "APQIdYNoupMPMPdq4FT-XNLOf9osn3am1DbPddZsRAv-YzHHwXKhJHgZPIJRSHvJEmP6UCF_hf9jb1nNVG46tIO0"
};
// Create a new ECDH key with valid usages
window.crypto.subtle.importKey("jwk", jwkKey, { "name": "ECDH", "namedCurve": "P-521"}, true, ["sign"])
.then((importedKey) => {
console.log("Key import succeed !!!");
}, (err) => {
console.log("FAIL: The 'import' operation threw an unexpected error: " + err.toString());
});
Actual results:
The following message appears in the console:
"FAIL: The 'import' operation threw an unexpected error: DataError: Data provided to an operation does not meet requirements"
Expected results:
It should throw a SyntaxError exception instead.
According to the last spec draft [1], which matches the last published [2] version, the JWK import should perform the following step:
- If the "d" field is present and if usages contains an entry which is not "deriveKey" or "deriveBits" then throw a SyntaxError.
[1] https://w3c.github.io/webcrypto/#ecdh-operations
[2] https://www.w3.org/TR/WebCryptoAPI/#ecdh-operations
Comment 3•1 year ago
|
||
(please move if there is a better component for this bug)
| Assignee | ||
Updated•1 year ago
|
| Assignee | ||
Updated•1 year ago
|
| Assignee | ||
Comment 4•1 year ago
|
||
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Comment 6•1 year ago
|
||
Backed out for causing failures at test_WebCrypto_ECDH.html.
Backout link: https://hg.mozilla.org/integration/autoland/rev/5a6d4f139a8b138ece7c4f7eeb8d800d669af462
Push with failures: https://treeherder.mozilla.org/jobs?repo=autoland&resultStatus=testfailed%2Cbusted%2Cexception%2Cretry%2Cusercancel&revision=d8f0ba47e2160521ada9bab1a3f96e0670348a7c
Failure log:
https://treeherder.mozilla.org/logviewer?job_id=476660455&repo=autoland&lineNumber=4731
https://treeherder.mozilla.org/logviewer?job_id=476660966&repo=autoland&lineNumber=4418
https://treeherder.mozilla.org/logviewer?job_id=476655770&repo=autoland&lineNumber=1768
Comment 8•1 year ago
|
||
Backed out for causing multiple perma failures
Backout link: https://hg.mozilla.org/integration/autoland/rev/037e19e8c0200c73aaee7890e5195d4e7a109c6b
Comment 10•1 year ago
|
||
| bugherder | ||
Updated•1 year ago
|
| Assignee | ||
Updated•1 year ago
|
Description
•