RESOLVED CONFIGURATION CHANGED 156114
WebCrypto can generate but fails to export RSA-OAEP-256 keys
https://bugs.webkit.org/show_bug.cgi?id=156114
Summary WebCrypto can generate but fails to export RSA-OAEP-256 keys
Roustem
Reported 2016-04-01 11:18:10 PDT
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
David Kilzer (:ddkilzer)
Comment 1 2016-04-02 00:36:44 PDT
Brent Fulgham
Comment 2 2016-04-13 20:09:12 PDT
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
Comment 3 2016-04-13 21:22:40 PDT
It looks like we are not up-to-date with http://www.w3.org/TR/WebCryptoAPI/.
Alexey Proskuryakov
Comment 4 2016-04-14 09:12:27 PDT
That statement is probably obsolete, JWK added many new identifiers since then.
Jiewen Tan
Comment 5 2016-11-15 11:11:04 PST
This bug should be resolved by Bug 164722.
Note You need to log in before you can comment on or make changes to this bug.