Diff
Modified: trunk/LayoutTests/ChangeLog (160495 => 160496)
--- trunk/LayoutTests/ChangeLog 2013-12-12 18:41:55 UTC (rev 160495)
+++ trunk/LayoutTests/ChangeLog 2013-12-12 18:42:53 UTC (rev 160496)
@@ -1,5 +1,15 @@
2013-12-12 Alexey Proskuryakov <[email protected]>
+ Public key in a generated KeyPair should always be extractable
+ https://bugs.webkit.org/show_bug.cgi?id=125643
+
+ Reviewed by Sam Weinig.
+
+ * crypto/subtle/rsa-oaep-generate-non-extractable-key-expected.txt: Added.
+ * crypto/subtle/rsa-oaep-generate-non-extractable-key.html: Added.
+
+2013-12-12 Alexey Proskuryakov <[email protected]>
+
Make algorithm.name return registered name, not normalized one
https://bugs.webkit.org/show_bug.cgi?id=125641
Added: trunk/LayoutTests/crypto/subtle/rsa-oaep-generate-non-extractable-key-expected.txt (0 => 160496)
--- trunk/LayoutTests/crypto/subtle/rsa-oaep-generate-non-extractable-key-expected.txt (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsa-oaep-generate-non-extractable-key-expected.txt 2013-12-12 18:42:53 UTC (rev 160496)
@@ -0,0 +1,23 @@
+Test that even when non-extractability is requested, the public key is still extractable.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Generating a key pair...
+PASS keyPair.toString() is '[object KeyPair]'
+PASS keyPair.publicKey.type is 'public'
+PASS keyPair.publicKey.extractable is true
+PASS keyPair.publicKey.algorithm.name is 'RSA-OAEP'
+PASS keyPair.publicKey.algorithm.modulusLength is 2048
+PASS bytesToHexString(keyPair.publicKey.algorithm.publicExponent) is '010001'
+PASS keyPair.publicKey.algorithm.hash is undefined.
+PASS keyPair.privateKey.type is 'private'
+PASS keyPair.privateKey.extractable is false
+PASS keyPair.privateKey.algorithm.name is 'RSA-OAEP'
+PASS keyPair.privateKey.algorithm.modulusLength is 2048
+PASS bytesToHexString(keyPair.privateKey.algorithm.publicExponent) is '010001'
+PASS keyPair.privateKey.algorithm.hash is undefined.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Property changes on: trunk/LayoutTests/crypto/subtle/rsa-oaep-generate-non-extractable-key-expected.txt
___________________________________________________________________
Added: svn:mime-type
Added: svn:eol-style
Added: trunk/LayoutTests/crypto/subtle/rsa-oaep-generate-non-extractable-key.html (0 => 160496)
--- trunk/LayoutTests/crypto/subtle/rsa-oaep-generate-non-extractable-key.html (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsa-oaep-generate-non-extractable-key.html 2013-12-12 18:42:53 UTC (rev 160496)
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test that even when non-extractability is requested, the public key is still extractable.");
+
+jsTestIsAsync = true;
+
+var algorithmKeyGen = {
+ name: "RSA-OAEP",
+ // RsaKeyGenParams
+ modulusLength: 2048,
+ publicExponent: new Uint8Array([0x01, 0x00, 0x01]), // Equivalent to 65537
+};
+var nonExtractable = false;
+
+debug("Generating a key pair...");
+crypto.subtle.generateKey(algorithmKeyGen, nonExtractable, []).then(function(result) {
+ keyPair = result;
+ shouldBe("keyPair.toString()", "'[object KeyPair]'");
+ shouldBe("keyPair.publicKey.type", "'public'");
+ shouldBe("keyPair.publicKey.extractable", "true");
+ shouldBe("keyPair.publicKey.algorithm.name", "'RSA-OAEP'");
+ shouldBe("keyPair.publicKey.algorithm.modulusLength", "2048");
+ shouldBe("bytesToHexString(keyPair.publicKey.algorithm.publicExponent)", "'010001'");
+ shouldBeUndefined("keyPair.publicKey.algorithm.hash");
+ shouldBe("keyPair.privateKey.type", "'private'");
+ shouldBe("keyPair.privateKey.extractable", "false");
+ shouldBe("keyPair.privateKey.algorithm.name", "'RSA-OAEP'");
+ shouldBe("keyPair.privateKey.algorithm.modulusLength", "2048");
+ shouldBe("bytesToHexString(keyPair.privateKey.algorithm.publicExponent)", "'010001'");
+ shouldBeUndefined("keyPair.privateKey.algorithm.hash");
+
+ finishJSTest();
+});
+</script>
+
+<script src=""
+</body>
+</html>
Property changes on: trunk/LayoutTests/crypto/subtle/rsa-oaep-generate-non-extractable-key.html
___________________________________________________________________
Added: svn:mime-type
Modified: trunk/Source/WebCore/ChangeLog (160495 => 160496)
--- trunk/Source/WebCore/ChangeLog 2013-12-12 18:41:55 UTC (rev 160495)
+++ trunk/Source/WebCore/ChangeLog 2013-12-12 18:42:53 UTC (rev 160496)
@@ -13,6 +13,20 @@
2013-12-12 Alexey Proskuryakov <[email protected]>
+ Public key in a generated KeyPair should always be extractable
+ https://bugs.webkit.org/show_bug.cgi?id=125643
+
+ Reviewed by Sam Weinig.
+
+ The spec doesn't explain how generateKey works with key pairs (there are open bugs
+ about that). Making public keys non-extractable makes no sense one way or another.
+
+ Test: crypto/subtle/rsa-oaep-generate-non-extractable-key.html
+
+ * crypto/mac/CryptoKeyRSAMac.cpp: (WebCore::CryptoKeyRSA::generatePair):
+
+2013-12-12 Alexey Proskuryakov <[email protected]>
+
Make algorithm.name return registered name, not normalized one
https://bugs.webkit.org/show_bug.cgi?id=125641
Modified: trunk/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp (160495 => 160496)
--- trunk/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp 2013-12-12 18:41:55 UTC (rev 160495)
+++ trunk/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp 2013-12-12 18:42:53 UTC (rev 160496)
@@ -267,7 +267,7 @@
return;
}
dispatch_async(dispatch_get_main_queue(), ^{
- RefPtr<CryptoKeyRSA> publicKey = CryptoKeyRSA::create(algorithm, CryptoKeyType::Public, ccPublicKey, extractable, usage);
+ RefPtr<CryptoKeyRSA> publicKey = CryptoKeyRSA::create(algorithm, CryptoKeyType::Public, ccPublicKey, true, usage);
RefPtr<CryptoKeyRSA> privateKey = CryptoKeyRSA::create(algorithm, CryptoKeyType::Private, ccPrivateKey, extractable, usage);
(*localCallback)(*CryptoKeyPair::create(publicKey.release(), privateKey.release()));
delete localCallback;