Bug 156114
Summary: | WebCrypto can generate but fails to export RSA-OAEP-256 keys | ||
---|---|---|---|
Product: | WebKit | Reporter: | Roustem <roustem> |
Component: | WebCore Misc. | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED CONFIGURATION CHANGED | ||
Severity: | Normal | CC: | ap, bfulgham, ddkilzer, jiewen_tan, rob, webkit-bug-importer |
Priority: | P2 | Keywords: | InRadar |
Version: | Safari Technology Preview | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Bug Depends on: | |||
Bug Blocks: | 160894 |
Roustem
crypto.webkitSubtle.generateKey({
name: "RSA-OAEP",
modulusLength: 2048,
publicExponent: new Uint8Array([0x01, 0x00, 0x01]),
hash: {name: "SHA-256"}
}, true, ["encrypt", "decrypt" ]).then((keypair) => {
console.log("Generated Key Pair:", keypair);
return crypto.webkitSubtle.exportKey("jwk", keypair.publicKey);
}).then((keydata) => {
console.log("Key Data:", keydata);
}).catch((error) => {
console.log("Error: ", error);
});
The code above should be able log both the newly Generated Key Pair and also log the Key Data.
It successfully generates the key pair:
[Log] Generated Key Pair: – KeyPair {publicKey: Key, privateKey: Key}
KeyPair {publicKey: Key, privateKey: Key}KeyPairprivateKey: Key {type: "private", extractable: true, algorithm: Object, usages: ["decrypt", "encrypt"]}KeypublicKey: Key {type: "public", extractable: true, algorithm: Object, usages: ["decrypt", "encrypt"]}KeyKeyPair Prototype
But not able to export it:
[Log] Error:
TypeError: Key algorithm and size do not map to any JWK algorithm identifier
exportKey
promiseReactionJob
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
David Kilzer (:ddkilzer)
<rdar://problem/25507292>
Brent Fulgham
From the ChangeLog in <http://trac.webkit.org/changeset/159944>:
This is happening because RSA-OAEP in JWK is more limited than general WebCrypto, as JWK only allows SHA-1 as hash.
I'm not sure whether that statement is correct.
Brent Fulgham
It looks like we are not up-to-date with http://www.w3.org/TR/WebCryptoAPI/.
Alexey Proskuryakov
That statement is probably obsolete, JWK added many new identifiers since then.
Jiewen Tan
This bug should be resolved by Bug 164722.