WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-165680-20161209151820.patch (text/plain), 30.82 KB, created by
Jiewen Tan
on 2016-12-09 15:19:03 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Jiewen Tan
Created:
2016-12-09 15:19:03 PST
Size:
30.82 KB
patch
obsolete
>Subversion Revision: 209633 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 2d489af4ff4ebe8ea139abead52204ac5c76213b..950041e56bf70adc2b9a1f2964dbd90718cc3827 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,25 @@ >+2016-12-09 Jiewen Tan <jiewen_tan@apple.com> >+ >+ [WebCrypto] RSA algorithms should allow importing keys without usages >+ https://bugs.webkit.org/show_bug.cgi?id=165680 >+ <rdar://problem/29601354> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Tests: crypto/subtle/rsa-oaep-import-jwk-public-key-empty-usages.html >+ crypto/subtle/rsa-oaep-import-spki-key-empty-usages.html >+ crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-empty-usages.html >+ crypto/subtle/rsaes-pkcs1-v1_5-import-spki-key-empty-usages.html >+ crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-empty-usages.html >+ crypto/subtle/rsassa-pkcs1-v1_5-import-spki-key-empty-usages.html >+ >+ * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp: >+ (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey): >+ * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: >+ (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey): >+ * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp: >+ (WebCore::CryptoAlgorithmRSA_OAEP::importKey): >+ > 2016-12-06 Jiewen Tan <jiewen_tan@apple.com> > > [Part 2 of 2] Add support for PKCS8 format while doing SubtleCrypto.importKey/exportKey >diff --git a/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp b/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp >index ea8eca16cdefd28dd17160e03614ffc37cb70d0a..5f1a479011b05480d18ed311ec9aecc2627aebcf 100644 >--- a/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp >+++ b/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp >@@ -105,7 +105,7 @@ void CryptoAlgorithmRSAES_PKCS1_v1_5::importKey(SubtleCrypto::KeyFormat format, > switch (format) { > case SubtleCrypto::KeyFormat::Jwk: { > JsonWebKey key = WTFMove(WTF::get<JsonWebKey>(data)); >- if ((key.d && (usages ^ CryptoKeyUsageDecrypt)) || (!key.d && (usages ^ CryptoKeyUsageEncrypt))) { >+ if (usages && ((key.d && (usages ^ CryptoKeyUsageDecrypt)) || (!key.d && (usages ^ CryptoKeyUsageEncrypt)))) { > exceptionCallback(SYNTAX_ERR); > return; > } >@@ -121,7 +121,7 @@ void CryptoAlgorithmRSAES_PKCS1_v1_5::importKey(SubtleCrypto::KeyFormat format, > break; > } > case SubtleCrypto::KeyFormat::Spki: { >- if (usages ^ CryptoKeyUsageEncrypt) { >+ if (usages && (usages ^ CryptoKeyUsageEncrypt)) { > exceptionCallback(SYNTAX_ERR); > return; > } >@@ -129,7 +129,7 @@ void CryptoAlgorithmRSAES_PKCS1_v1_5::importKey(SubtleCrypto::KeyFormat format, > break; > } > case SubtleCrypto::KeyFormat::Pkcs8: { >- if (usages ^ CryptoKeyUsageDecrypt) { >+ if (usages && (usages ^ CryptoKeyUsageDecrypt)) { > exceptionCallback(SYNTAX_ERR); > return; > } >diff --git a/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp b/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp >index 9ff13fc5387e4bd68a408f6e22bf7a7331afb398..3411a5c75dbe4b54adf05d0292ebe5d03884efaa 100644 >--- a/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp >+++ b/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp >@@ -116,7 +116,7 @@ void CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey(SubtleCrypto::KeyFormat format, > case SubtleCrypto::KeyFormat::Jwk: { > JsonWebKey key = WTFMove(WTF::get<JsonWebKey>(data)); > >- if ((key.d && (usages ^ CryptoKeyUsageSign)) || (!key.d && (usages ^ CryptoKeyUsageVerify))) { >+ if (usages && ((key.d && (usages ^ CryptoKeyUsageSign)) || (!key.d && (usages ^ CryptoKeyUsageVerify)))) { > exceptionCallback(SYNTAX_ERR); > return; > } >@@ -154,7 +154,7 @@ void CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey(SubtleCrypto::KeyFormat format, > break; > } > case SubtleCrypto::KeyFormat::Spki: { >- if (usages ^ CryptoKeyUsageVerify) { >+ if (usages && (usages ^ CryptoKeyUsageVerify)) { > exceptionCallback(SYNTAX_ERR); > return; > } >@@ -163,7 +163,7 @@ void CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey(SubtleCrypto::KeyFormat format, > break; > } > case SubtleCrypto::KeyFormat::Pkcs8: { >- if (usages ^ CryptoKeyUsageSign) { >+ if (usages && (usages ^ CryptoKeyUsageSign)) { > exceptionCallback(SYNTAX_ERR); > return; > } >diff --git a/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp b/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp >index 5734ddea850c9b1cef7a87cfc20614c8f920134f..7207951d4bad666f1a0397af9f73ffdfc1b150e8 100644 >--- a/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp >+++ b/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp >@@ -128,6 +128,7 @@ void CryptoAlgorithmRSA_OAEP::importKey(SubtleCrypto::KeyFormat format, KeyData& > isUsagesAllowed = isUsagesAllowed || !(usages ^ CryptoKeyUsageWrapKey); > isUsagesAllowed = isUsagesAllowed || !(usages ^ (CryptoKeyUsageEncrypt | CryptoKeyUsageWrapKey)); > } >+ isUsagesAllowed = isUsagesAllowed || !usages; > if (!isUsagesAllowed) { > exceptionCallback(SYNTAX_ERR); > return; >@@ -167,7 +168,7 @@ void CryptoAlgorithmRSA_OAEP::importKey(SubtleCrypto::KeyFormat format, KeyData& > break; > } > case SubtleCrypto::KeyFormat::Spki: { >- if ((usages ^ CryptoKeyUsageEncrypt) && (usages ^ CryptoKeyUsageWrapKey) && (usages ^ (CryptoKeyUsageEncrypt | CryptoKeyUsageWrapKey))) { >+ if (usages && (usages ^ CryptoKeyUsageEncrypt) && (usages ^ CryptoKeyUsageWrapKey) && (usages ^ (CryptoKeyUsageEncrypt | CryptoKeyUsageWrapKey))) { > exceptionCallback(SYNTAX_ERR); > return; > } >@@ -176,7 +177,7 @@ void CryptoAlgorithmRSA_OAEP::importKey(SubtleCrypto::KeyFormat format, KeyData& > break; > } > case SubtleCrypto::KeyFormat::Pkcs8: { >- if ((usages ^ CryptoKeyUsageDecrypt) && (usages ^ CryptoKeyUsageUnwrapKey) && (usages ^ (CryptoKeyUsageDecrypt | CryptoKeyUsageUnwrapKey))) { >+ if (usages && (usages ^ CryptoKeyUsageDecrypt) && (usages ^ CryptoKeyUsageUnwrapKey) && (usages ^ (CryptoKeyUsageDecrypt | CryptoKeyUsageUnwrapKey))) { > exceptionCallback(SYNTAX_ERR); > return; > } >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 4c94b0f8def3178c4581aad449e0fcf0a935cbf5..5e61e5773032f167810fde69b751a7381fa28fe8 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,24 @@ >+2016-12-09 Jiewen Tan <jiewen_tan@apple.com> >+ >+ [WebCrypto] RSA algorithms should allow importing keys without usages >+ https://bugs.webkit.org/show_bug.cgi?id=165680 >+ <rdar://problem/29601354> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * crypto/subtle/rsa-oaep-import-jwk-public-key-empty-usages-expected.txt: Added. >+ * crypto/subtle/rsa-oaep-import-jwk-public-key-empty-usages.html: Added. >+ * crypto/subtle/rsa-oaep-import-spki-key-empty-usages-expected.txt: Added. >+ * crypto/subtle/rsa-oaep-import-spki-key-empty-usages.html: Added. >+ * crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-empty-usages-expected.txt: Added. >+ * crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-empty-usages.html: Added. >+ * crypto/subtle/rsaes-pkcs1-v1_5-import-spki-key-empty-usages-expected.txt: Added. >+ * crypto/subtle/rsaes-pkcs1-v1_5-import-spki-key-empty-usages.html: Added. >+ * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-empty-usages-expected.txt: Added. >+ * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-empty-usages.html: Added. >+ * crypto/subtle/rsassa-pkcs1-v1_5-import-spki-key-empty-usages-expected.txt: Added. >+ * crypto/subtle/rsassa-pkcs1-v1_5-import-spki-key-empty-usages.html: Added. >+ > 2016-12-06 Jiewen Tan <jiewen_tan@apple.com> > > [Part 2 of 2] Add support for PKCS8 format while doing SubtleCrypto.importKey/exportKey >diff --git a/LayoutTests/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog >index 9e99399fa0859e3f84142677771247e2f81bd281..67bb3d4711a1091ed87843de5d214b15a05eedf1 100644 >--- a/LayoutTests/imported/w3c/ChangeLog >+++ b/LayoutTests/imported/w3c/ChangeLog >@@ -1,3 +1,13 @@ >+2016-12-09 Jiewen Tan <jiewen_tan@apple.com> >+ >+ [WebCrypto] RSA algorithms should allow importing keys without usages >+ https://bugs.webkit.org/show_bug.cgi?id=165680 >+ <rdar://problem/29601354> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebCryptoAPI/encrypt_decrypt/test_rsa_oaep-expected.txt: >+ > 2016-12-06 Jiewen Tan <jiewen_tan@apple.com> > > [Part 2 of 2] Add support for PKCS8 format while doing SubtleCrypto.importKey/exportKey >diff --git a/LayoutTests/crypto/subtle/rsa-oaep-import-jwk-public-key-empty-usages-expected.txt b/LayoutTests/crypto/subtle/rsa-oaep-import-jwk-public-key-empty-usages-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..6d900943ff7ccef773a1c4b16c3d77c871e96486 >--- /dev/null >+++ b/LayoutTests/crypto/subtle/rsa-oaep-import-jwk-public-key-empty-usages-expected.txt >@@ -0,0 +1,18 @@ >+Test importing a JWK RSA-OAEP public key with SHA-1 and empty usages >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+Importing a key... >+PASS publicKey.toString() is '[object CryptoKey]' >+PASS publicKey.type is 'public' >+PASS publicKey.extractable is true >+PASS publicKey.algorithm.name is 'RSA-OAEP' >+PASS publicKey.algorithm.modulusLength is 2048 >+PASS bytesToHexString(publicKey.algorithm.publicExponent) is '010001' >+PASS publicKey.algorithm.hash.name is 'SHA-1' >+PASS publicKey.usages is [ ] >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/crypto/subtle/rsa-oaep-import-jwk-public-key-empty-usages.html b/LayoutTests/crypto/subtle/rsa-oaep-import-jwk-public-key-empty-usages.html >new file mode 100644 >index 0000000000000000000000000000000000000000..0378546d95577b5fb8a43efa2a1e41d88d036d7c >--- /dev/null >+++ b/LayoutTests/crypto/subtle/rsa-oaep-import-jwk-public-key-empty-usages.html >@@ -0,0 +1,47 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../../resources/js-test-pre.js"></script> >+<script src="../resources/common.js"></script> >+</head> >+<body> >+<p id="description"></p> >+<div id="console"></div> >+ >+<script> >+description("Test importing a JWK RSA-OAEP public key with SHA-1 and empty usages"); >+ >+jsTestIsAsync = true; >+ >+var jwkKey = { >+ kty: "RSA", >+ alg: "RSA-OAEP", >+ use: "enc", >+ key_ops: ["encrypt", "wrapKey"], >+ ext: true, >+ n: "rcCUCv7Oc1HVam1DIhCzqknThWawOp8QLk8Ziy2p10ByjQFCajoFiyuAWl-R1WXZaf4xitLRracT9agpzIzc-MbLSHIGgWQGO21lGiImy5ftZ-D8bHAqRz2y15pzD4c4CEou7XSSLDoRnR0QG5MsDhD6s2gV9mwHkrtkCxtMWdBi-77as8wGmlNRldcOSgZDLK8UnCSgA1OguZ989bFyc8tOOEIb0xUSfPSz3LPSCnyYz68aDjmKVeNH-ig857OScyWbGyEy3Biw64qun3juUlNWsJ3zngkOdteYWytx5Qr4XKNs6R-Myyq72KUp02mJDZiiyiglxML_i3-_CeecCw", >+ e: "AQAB" >+}; >+var extractable = true; >+ >+debug("Importing a key..."); >+crypto.subtle.importKey("jwk", jwkKey, {name: "RSA-OAEP", hash: "SHA-1"}, extractable, [ ]).then(function(result) { >+ publicKey = result; >+ >+ shouldBe("publicKey.toString()", "'[object CryptoKey]'"); >+ shouldBe("publicKey.type", "'public'"); >+ shouldBe("publicKey.extractable", "true"); >+ shouldBe("publicKey.algorithm.name", "'RSA-OAEP'"); >+ shouldBe("publicKey.algorithm.modulusLength", "2048"); >+ shouldBe("bytesToHexString(publicKey.algorithm.publicExponent)", "'010001'"); >+ shouldBe("publicKey.algorithm.hash.name", "'SHA-1'"); >+ shouldBe("publicKey.usages", "[ ]"); >+ >+ finishJSTest(); >+}); >+ >+</script> >+ >+<script src="../../resources/js-test-post.js"></script> >+</body> >+</html> >\ No newline at end of file >diff --git a/LayoutTests/crypto/subtle/rsa-oaep-import-spki-key-empty-usages-expected.txt b/LayoutTests/crypto/subtle/rsa-oaep-import-spki-key-empty-usages-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..3823ba021b6d2c0289d4438fb3474ae255b9b139 >--- /dev/null >+++ b/LayoutTests/crypto/subtle/rsa-oaep-import-spki-key-empty-usages-expected.txt >@@ -0,0 +1,18 @@ >+Test importing a SPKI RSA-OAEP key with empty usages >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+Importing a key... >+PASS publicKey.toString() is '[object CryptoKey]' >+PASS publicKey.type is 'public' >+PASS publicKey.extractable is true >+PASS publicKey.algorithm.name is 'RSA-OAEP' >+PASS publicKey.algorithm.modulusLength is 2048 >+PASS bytesToHexString(publicKey.algorithm.publicExponent) is '010001' >+PASS publicKey.algorithm.hash.name is 'SHA-1' >+PASS publicKey.usages is [ ] >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/crypto/subtle/rsa-oaep-import-spki-key-empty-usages.html b/LayoutTests/crypto/subtle/rsa-oaep-import-spki-key-empty-usages.html >new file mode 100644 >index 0000000000000000000000000000000000000000..1f100670debaa1dc1394ea4109a1596a0e549821 >--- /dev/null >+++ b/LayoutTests/crypto/subtle/rsa-oaep-import-spki-key-empty-usages.html >@@ -0,0 +1,40 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../../resources/js-test-pre.js"></script> >+<script src="../resources/common.js"></script> >+</head> >+<body> >+<p id="description"></p> >+<div id="console"></div> >+ >+<script> >+description("Test importing a SPKI RSA-OAEP key with empty usages"); >+ >+jsTestIsAsync = true; >+ >+// Generated from OpenSSL >+var spkiKey = Base64URL.parse("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwCjRCtFwvSNYMZ07u5SxARxglJl75T7bUZXFsDVxHkMhpNC2RaN4jWE5bwYUDMeD2fVmxhpaUQn/6AbFLh6gHxtwrCfc7rIo/SfDdGd3GkRlXK5xXwGuM6MvP9nuZHaarIyArRFh2U2UZxFlVsKI0pSHo6n58W1fPZ1syOoVEZ/WYE6gLhMMwfpeAm97mro7mekRdMULOV/mR5Ul3CHm9Zt93Dc8GpnPA8bhLiB0VNyGTEMa06nJul4gj1sjxLDoUvZY2EWq7oUUnfLBUYMfiqK0kQcW94wvBrIq2DQUApLyTTbaAOY46TLwX6c8LtubJriYKTC5a9Bb0/7ovTWB0wIDAQAB"); >+var extractable = true; >+ >+debug("Importing a key..."); >+crypto.subtle.importKey("spki", spkiKey, {name: "RSA-OAEP", hash: "sha-1"}, extractable, [ ]).then(function(result) { >+ publicKey = result; >+ >+ shouldBe("publicKey.toString()", "'[object CryptoKey]'"); >+ shouldBe("publicKey.type", "'public'"); >+ shouldBe("publicKey.extractable", "true"); >+ shouldBe("publicKey.algorithm.name", "'RSA-OAEP'"); >+ shouldBe("publicKey.algorithm.modulusLength", "2048"); >+ shouldBe("bytesToHexString(publicKey.algorithm.publicExponent)", "'010001'"); >+ shouldBe("publicKey.algorithm.hash.name", "'SHA-1'"); >+ shouldBe("publicKey.usages", "[ ]"); >+ >+ finishJSTest(); >+}); >+ >+</script> >+ >+<script src="../../resources/js-test-post.js"></script> >+</body> >+</html> >diff --git a/LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-empty-usages-expected.txt b/LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-empty-usages-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..fb92935ee1a9a5b17e55df4d3fd08472415da0af >--- /dev/null >+++ b/LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-empty-usages-expected.txt >@@ -0,0 +1,18 @@ >+Test importing a JWK RSAES-PKCS1-v1_5 public key with empty usages >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+Importing a key... >+PASS publicKey.toString() is '[object CryptoKey]' >+PASS publicKey.type is 'public' >+PASS publicKey.extractable is true >+PASS publicKey.algorithm.name is 'RSAES-PKCS1-v1_5' >+PASS publicKey.algorithm.modulusLength is 2048 >+PASS bytesToHexString(publicKey.algorithm.publicExponent) is '010001' >+PASS publicKey.algorithm.hash is undefined. >+PASS publicKey.usages is [ ] >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-empty-usages.html b/LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-empty-usages.html >new file mode 100644 >index 0000000000000000000000000000000000000000..5b71451267bfdd913bfb52efdc0ec13b8a619d7d >--- /dev/null >+++ b/LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-empty-usages.html >@@ -0,0 +1,47 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../../resources/js-test-pre.js"></script> >+<script src="../resources/common.js"></script> >+</head> >+<body> >+<p id="description"></p> >+<div id="console"></div> >+ >+<script> >+description("Test importing a JWK RSAES-PKCS1-v1_5 public key with empty usages"); >+ >+jsTestIsAsync = true; >+ >+var jwkKey = { >+ kty: "RSA", >+ alg: "RSA1_5", >+ use: "enc", >+ key_ops: ["encrypt"], >+ ext: true, >+ n: "rcCUCv7Oc1HVam1DIhCzqknThWawOp8QLk8Ziy2p10ByjQFCajoFiyuAWl-R1WXZaf4xitLRracT9agpzIzc-MbLSHIGgWQGO21lGiImy5ftZ-D8bHAqRz2y15pzD4c4CEou7XSSLDoRnR0QG5MsDhD6s2gV9mwHkrtkCxtMWdBi-77as8wGmlNRldcOSgZDLK8UnCSgA1OguZ989bFyc8tOOEIb0xUSfPSz3LPSCnyYz68aDjmKVeNH-ig857OScyWbGyEy3Biw64qun3juUlNWsJ3zngkOdteYWytx5Qr4XKNs6R-Myyq72KUp02mJDZiiyiglxML_i3-_CeecCw", >+ e: "AQAB" >+}; >+var extractable = true; >+ >+debug("Importing a key..."); >+crypto.subtle.importKey("jwk", jwkKey, "RSAES-PKCS1-v1_5", extractable, [ ]).then(function(result) { >+ publicKey = result; >+ >+ shouldBe("publicKey.toString()", "'[object CryptoKey]'"); >+ shouldBe("publicKey.type", "'public'"); >+ shouldBe("publicKey.extractable", "true"); >+ shouldBe("publicKey.algorithm.name", "'RSAES-PKCS1-v1_5'"); >+ shouldBe("publicKey.algorithm.modulusLength", "2048"); >+ shouldBe("bytesToHexString(publicKey.algorithm.publicExponent)", "'010001'"); >+ shouldBeUndefined("publicKey.algorithm.hash"); >+ shouldBe("publicKey.usages", "[ ]"); >+ >+ finishJSTest(); >+}); >+ >+</script> >+ >+<script src="../../resources/js-test-post.js"></script> >+</body> >+</html> >diff --git a/LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-import-spki-key-empty-usages-expected.txt b/LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-import-spki-key-empty-usages-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..0b3f181c9e6fd2ff0fb179aa1cc06d32267922fc >--- /dev/null >+++ b/LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-import-spki-key-empty-usages-expected.txt >@@ -0,0 +1,18 @@ >+Test importing a SPKI RSAES-PKCS1-v1_5 key with empty usages >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+Importing a key... >+PASS publicKey.toString() is '[object CryptoKey]' >+PASS publicKey.type is 'public' >+PASS publicKey.extractable is true >+PASS publicKey.algorithm.name is 'RSAES-PKCS1-v1_5' >+PASS publicKey.algorithm.modulusLength is 2048 >+PASS bytesToHexString(publicKey.algorithm.publicExponent) is '010001' >+PASS publicKey.algorithm.hash is undefined. >+PASS publicKey.usages is [ ] >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-import-spki-key-empty-usages.html b/LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-import-spki-key-empty-usages.html >new file mode 100644 >index 0000000000000000000000000000000000000000..ab482be0ad71fb506552b642c60fa3f76b1d5d0b >--- /dev/null >+++ b/LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-import-spki-key-empty-usages.html >@@ -0,0 +1,40 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../../resources/js-test-pre.js"></script> >+<script src="../resources/common.js"></script> >+</head> >+<body> >+<p id="description"></p> >+<div id="console"></div> >+ >+<script> >+description("Test importing a SPKI RSAES-PKCS1-v1_5 key with empty usages"); >+ >+jsTestIsAsync = true; >+ >+// Generated from OpenSSL >+var spkiKey = Base64URL.parse("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwCjRCtFwvSNYMZ07u5SxARxglJl75T7bUZXFsDVxHkMhpNC2RaN4jWE5bwYUDMeD2fVmxhpaUQn/6AbFLh6gHxtwrCfc7rIo/SfDdGd3GkRlXK5xXwGuM6MvP9nuZHaarIyArRFh2U2UZxFlVsKI0pSHo6n58W1fPZ1syOoVEZ/WYE6gLhMMwfpeAm97mro7mekRdMULOV/mR5Ul3CHm9Zt93Dc8GpnPA8bhLiB0VNyGTEMa06nJul4gj1sjxLDoUvZY2EWq7oUUnfLBUYMfiqK0kQcW94wvBrIq2DQUApLyTTbaAOY46TLwX6c8LtubJriYKTC5a9Bb0/7ovTWB0wIDAQAB"); >+var extractable = true; >+ >+debug("Importing a key..."); >+crypto.subtle.importKey("spki", spkiKey, "RSAES-PKCS1-v1_5", extractable, [ ]).then(function(result) { >+ publicKey = result; >+ >+ shouldBe("publicKey.toString()", "'[object CryptoKey]'"); >+ shouldBe("publicKey.type", "'public'"); >+ shouldBe("publicKey.extractable", "true"); >+ shouldBe("publicKey.algorithm.name", "'RSAES-PKCS1-v1_5'"); >+ shouldBe("publicKey.algorithm.modulusLength", "2048"); >+ shouldBe("bytesToHexString(publicKey.algorithm.publicExponent)", "'010001'"); >+ shouldBeUndefined("publicKey.algorithm.hash"); >+ shouldBe("publicKey.usages", "[ ]"); >+ >+ finishJSTest(); >+}); >+ >+</script> >+ >+<script src="../../resources/js-test-post.js"></script> >+</body> >+</html> >diff --git a/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-empty-usages-expected.txt b/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-empty-usages-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..8411c511caa24e5a77989cbb51f3a933dbfa41cb >--- /dev/null >+++ b/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-empty-usages-expected.txt >@@ -0,0 +1,18 @@ >+Test importing a JWK RSASSA-PKCS1-v1_5 public key with SHA-1 and empty usages >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+Importing a key... >+PASS publicKey.toString() is '[object CryptoKey]' >+PASS publicKey.type is 'public' >+PASS publicKey.extractable is true >+PASS publicKey.algorithm.name is 'RSASSA-PKCS1-v1_5' >+PASS publicKey.algorithm.modulusLength is 2048 >+PASS bytesToHexString(publicKey.algorithm.publicExponent) is '010001' >+PASS publicKey.algorithm.hash.name is 'SHA-1' >+PASS publicKey.usages is [ ] >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-empty-usages.html b/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-empty-usages.html >new file mode 100644 >index 0000000000000000000000000000000000000000..106fc32a3941f180b4753e7843db0cb5ae104db9 >--- /dev/null >+++ b/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-empty-usages.html >@@ -0,0 +1,47 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../../resources/js-test-pre.js"></script> >+<script src="../resources/common.js"></script> >+</head> >+<body> >+<p id="description"></p> >+<div id="console"></div> >+ >+<script> >+description("Test importing a JWK RSASSA-PKCS1-v1_5 public key with SHA-1 and empty usages"); >+ >+jsTestIsAsync = true; >+ >+var jwkKey = { >+ kty: "RSA", >+ alg: "RS1", >+ use: "sig", >+ key_ops: ["verify"], >+ ext: true, >+ n: "rcCUCv7Oc1HVam1DIhCzqknThWawOp8QLk8Ziy2p10ByjQFCajoFiyuAWl-R1WXZaf4xitLRracT9agpzIzc-MbLSHIGgWQGO21lGiImy5ftZ-D8bHAqRz2y15pzD4c4CEou7XSSLDoRnR0QG5MsDhD6s2gV9mwHkrtkCxtMWdBi-77as8wGmlNRldcOSgZDLK8UnCSgA1OguZ989bFyc8tOOEIb0xUSfPSz3LPSCnyYz68aDjmKVeNH-ig857OScyWbGyEy3Biw64qun3juUlNWsJ3zngkOdteYWytx5Qr4XKNs6R-Myyq72KUp02mJDZiiyiglxML_i3-_CeecCw", >+ e: "AQAB" >+}; >+var extractable = true; >+ >+debug("Importing a key..."); >+crypto.subtle.importKey("jwk", jwkKey, {name: "RSASSA-PKCS1-v1_5", hash: "SHA-1"}, extractable, [ ]).then(function(result) { >+ publicKey = result; >+ >+ shouldBe("publicKey.toString()", "'[object CryptoKey]'"); >+ shouldBe("publicKey.type", "'public'"); >+ shouldBe("publicKey.extractable", "true"); >+ shouldBe("publicKey.algorithm.name", "'RSASSA-PKCS1-v1_5'"); >+ shouldBe("publicKey.algorithm.modulusLength", "2048"); >+ shouldBe("bytesToHexString(publicKey.algorithm.publicExponent)", "'010001'"); >+ shouldBe("publicKey.algorithm.hash.name", "'SHA-1'"); >+ shouldBe("publicKey.usages", "[ ]"); >+ >+ finishJSTest(); >+}); >+ >+</script> >+ >+<script src="../../resources/js-test-post.js"></script> >+</body> >+</html> >diff --git a/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-spki-key-empty-usages-expected.txt b/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-spki-key-empty-usages-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..5ed412d0a09da40b1566aefc0c58bdcb1f147e47 >--- /dev/null >+++ b/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-spki-key-empty-usages-expected.txt >@@ -0,0 +1,18 @@ >+Test importing a SPKI RSASSA-PKCS1-v1_5 key with empty usages >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+Importing a key... >+PASS publicKey.toString() is '[object CryptoKey]' >+PASS publicKey.type is 'public' >+PASS publicKey.extractable is true >+PASS publicKey.algorithm.name is 'RSASSA-PKCS1-v1_5' >+PASS publicKey.algorithm.modulusLength is 2048 >+PASS bytesToHexString(publicKey.algorithm.publicExponent) is '010001' >+PASS publicKey.algorithm.hash.name is 'SHA-1' >+PASS publicKey.usages is [ ] >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-spki-key-empty-usages.html b/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-spki-key-empty-usages.html >new file mode 100644 >index 0000000000000000000000000000000000000000..7d35c88b72333453f6a4d5c4bcf9bc5cc1877aaa >--- /dev/null >+++ b/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-spki-key-empty-usages.html >@@ -0,0 +1,40 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../../resources/js-test-pre.js"></script> >+<script src="../resources/common.js"></script> >+</head> >+<body> >+<p id="description"></p> >+<div id="console"></div> >+ >+<script> >+description("Test importing a SPKI RSASSA-PKCS1-v1_5 key with empty usages"); >+ >+jsTestIsAsync = true; >+ >+// Generated from OpenSSL >+var spkiKey = Base64URL.parse("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwCjRCtFwvSNYMZ07u5SxARxglJl75T7bUZXFsDVxHkMhpNC2RaN4jWE5bwYUDMeD2fVmxhpaUQn/6AbFLh6gHxtwrCfc7rIo/SfDdGd3GkRlXK5xXwGuM6MvP9nuZHaarIyArRFh2U2UZxFlVsKI0pSHo6n58W1fPZ1syOoVEZ/WYE6gLhMMwfpeAm97mro7mekRdMULOV/mR5Ul3CHm9Zt93Dc8GpnPA8bhLiB0VNyGTEMa06nJul4gj1sjxLDoUvZY2EWq7oUUnfLBUYMfiqK0kQcW94wvBrIq2DQUApLyTTbaAOY46TLwX6c8LtubJriYKTC5a9Bb0/7ovTWB0wIDAQAB"); >+var extractable = true; >+ >+debug("Importing a key..."); >+crypto.subtle.importKey("spki", spkiKey, {name: "RSASSA-PKCS1-v1_5", hash: "sha-1"}, extractable, [ ]).then(function(result) { >+ publicKey = result; >+ >+ shouldBe("publicKey.toString()", "'[object CryptoKey]'"); >+ shouldBe("publicKey.type", "'public'"); >+ shouldBe("publicKey.extractable", "true"); >+ shouldBe("publicKey.algorithm.name", "'RSASSA-PKCS1-v1_5'"); >+ shouldBe("publicKey.algorithm.modulusLength", "2048"); >+ shouldBe("bytesToHexString(publicKey.algorithm.publicExponent)", "'010001'"); >+ shouldBe("publicKey.algorithm.hash.name", "'SHA-1'"); >+ shouldBe("publicKey.usages", "[ ]"); >+ >+ finishJSTest(); >+}); >+ >+</script> >+ >+<script src="../../resources/js-test-post.js"></script> >+</body> >+</html> >diff --git a/LayoutTests/imported/w3c/WebCryptoAPI/encrypt_decrypt/test_rsa_oaep-expected.txt b/LayoutTests/imported/w3c/WebCryptoAPI/encrypt_decrypt/test_rsa_oaep-expected.txt >index b5f6c8a51694705e832c4d4f286a57091f52f608..3b473fb595556c275b0b8a675e55d3a004376eb4 100644 >--- a/LayoutTests/imported/w3c/WebCryptoAPI/encrypt_decrypt/test_rsa_oaep-expected.txt >+++ b/LayoutTests/imported/w3c/WebCryptoAPI/encrypt_decrypt/test_rsa_oaep-expected.txt >@@ -97,16 +97,16 @@ PASS RSA-OAEP with SHA-1 and a label using privateKey to encrypt > PASS RSA-OAEP with SHA-256 and a label using privateKey to encrypt > PASS RSA-OAEP with SHA-384 and a label using privateKey to encrypt > PASS RSA-OAEP with SHA-512 and a label using privateKey to encrypt >-FAIL importVectorKeys step: RSA-OAEP with SHA-1 and no label no encrypt usage assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-1 and no label. Message: ''A required parameter was missing or out-of-range'' Reached unreachable code >-FAIL importVectorKeys step: RSA-OAEP with SHA-256 and no label no encrypt usage assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-256 and no label. Message: ''A required parameter was missing or out-of-range'' Reached unreachable code >-FAIL importVectorKeys step: RSA-OAEP with SHA-384 and no label no encrypt usage assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-384 and no label. Message: ''A required parameter was missing or out-of-range'' Reached unreachable code >-FAIL importVectorKeys step: RSA-OAEP with SHA-512 and no label no encrypt usage assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-512 and no label. Message: ''A required parameter was missing or out-of-range'' Reached unreachable code >-FAIL importVectorKeys step: RSA-OAEP with SHA-1 and empty label no encrypt usage assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-1 and empty label. Message: ''A required parameter was missing or out-of-range'' Reached unreachable code >-FAIL importVectorKeys step: RSA-OAEP with SHA-256 and empty label no encrypt usage assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-256 and empty label. Message: ''A required parameter was missing or out-of-range'' Reached unreachable code >-FAIL importVectorKeys step: RSA-OAEP with SHA-384 and empty label no encrypt usage assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-384 and empty label. Message: ''A required parameter was missing or out-of-range'' Reached unreachable code >-FAIL importVectorKeys step: RSA-OAEP with SHA-512 and empty label no encrypt usage assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-512 and empty label. Message: ''A required parameter was missing or out-of-range'' Reached unreachable code >-FAIL importVectorKeys step: RSA-OAEP with SHA-1 and a label no encrypt usage assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-1 and a label. Message: ''A required parameter was missing or out-of-range'' Reached unreachable code >-FAIL importVectorKeys step: RSA-OAEP with SHA-256 and a label no encrypt usage assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-256 and a label. Message: ''A required parameter was missing or out-of-range'' Reached unreachable code >-FAIL importVectorKeys step: RSA-OAEP with SHA-384 and a label no encrypt usage assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-384 and a label. Message: ''A required parameter was missing or out-of-range'' Reached unreachable code >-FAIL importVectorKeys step: RSA-OAEP with SHA-512 and a label no encrypt usage assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-512 and a label. Message: ''A required parameter was missing or out-of-range'' Reached unreachable code >+PASS RSA-OAEP with SHA-1 and no label no encrypt usage >+PASS RSA-OAEP with SHA-256 and no label no encrypt usage >+PASS RSA-OAEP with SHA-384 and no label no encrypt usage >+PASS RSA-OAEP with SHA-512 and no label no encrypt usage >+PASS RSA-OAEP with SHA-1 and empty label no encrypt usage >+PASS RSA-OAEP with SHA-256 and empty label no encrypt usage >+PASS RSA-OAEP with SHA-384 and empty label no encrypt usage >+PASS RSA-OAEP with SHA-512 and empty label no encrypt usage >+PASS RSA-OAEP with SHA-1 and a label no encrypt usage >+PASS RSA-OAEP with SHA-256 and a label no encrypt usage >+PASS RSA-OAEP with SHA-384 and a label no encrypt usage >+PASS RSA-OAEP with SHA-512 and a label no encrypt usage >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 165680
: 296717