+2016-11-16 Jiewen Tan <jiewen_tan@apple.com>
+
+ Add more tests for SubtleCrypto::importKey and SubtleCrypto::exportKey
+ https://bugs.webkit.org/show_bug.cgi?id=164815
+ <rdar://problem/29281660>
+
+ Reviewed by Brent Fulgham.
+
+ * crypto/subtle/aes-import-jwk-key-export-jwk-key.html: Added.
+ * crypto/subtle/aes-import-jwk-key-export-raw-key.html: Added.
+ * crypto/subtle/aes-import-raw-key-export-jwk-key.html: Added.
+ * crypto/subtle/aes-import-raw-key-export-raw-key.html: Added.
+ * crypto/subtle/hmac-import-jwk-key-export-jwk-key.html: Added.
+ * crypto/subtle/hmac-import-jwk-key-export-raw-key.html: Added.
+ * crypto/subtle/hmac-import-raw-key-export-jwk-key.html: Added.
+ * crypto/subtle/hmac-import-raw-key-export-raw-key.html: Added.
+ * crypto/subtle/rsa-import-jwk-key-export-jwk-key-private.html: Added.
+ * crypto/subtle/rsa-import-jwk-key-export-jwk-key-public.html: Added.
+
2016-11-16 Ryan Haddad <ryanhaddad@apple.com>
Updating TestExpectations for two http/tests/security/module-crossorigin tests.
--- /dev/null
+Test importing a JWK AES-CBC key with legnth 128 and then export it in JWK format
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Importing a key...
+Exporting a key...
+PASS exportedJwkKey.kty is jwkKey.kty
+PASS exportedJwkKey.k is jwkKey.k
+PASS exportedJwkKey.alg is jwkKey.alg
+PASS exportedJwkKey.key_ops is jwkKey.key_ops
+PASS exportedJwkKey.ext is jwkKey.ext
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
--- /dev/null
+<!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 AES-CBC key with legnth 128 and then export it in JWK format");
+
+jsTestIsAsync = true;
+
+var jwkKey = {
+ kty: "oct",
+ k: "KbXExKw7lIKkvDHi4ud3lg",
+ alg: "A128CBC",
+ key_ops: ["decrypt", "encrypt", "unwrapKey", "wrapKey"],
+ ext: true,
+};
+var extractable = true;
+
+debug("Importing a key...");
+crypto.subtle.importKey("jwk", jwkKey, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]).then(function(cryptoKey) {
+ debug("Exporting a key...");
+ return crypto.subtle.exportKey("jwk", cryptoKey);
+}).then(function(result) {
+ exportedJwkKey = result;
+
+ shouldBe("exportedJwkKey.kty", "jwkKey.kty");
+ shouldBe("exportedJwkKey.k", "jwkKey.k");
+ shouldBe("exportedJwkKey.alg", "jwkKey.alg");
+ shouldBe("exportedJwkKey.key_ops", "jwkKey.key_ops");
+ shouldBe("exportedJwkKey.ext", "jwkKey.ext");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
--- /dev/null
+Test importing a JWK AES-CBC key with legnth 128 and then export it in raw format
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Importing a key...
+Exporting a key...
+PASS Base64URL.stringify(exportedRawKey) is jwkKey.k
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
--- /dev/null
+<!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 AES-CBC key with legnth 128 and then export it in raw format");
+
+jsTestIsAsync = true;
+
+var jwkKey = {
+ kty: "oct",
+ k: "KbXExKw7lIKkvDHi4ud3lg",
+ alg: "A128CBC",
+ key_ops: ["decrypt", "encrypt", "unwrapKey", "wrapKey"],
+ ext: true,
+};
+var extractable = true;
+
+debug("Importing a key...");
+crypto.subtle.importKey("jwk", jwkKey, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]).then(function(cryptoKey) {
+ debug("Exporting a key...");
+ return crypto.subtle.exportKey("raw", cryptoKey);
+}).then(function(result) {
+ exportedRawKey = new Uint8Array(result);
+
+ shouldBe("Base64URL.stringify(exportedRawKey)", "jwkKey.k");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
--- /dev/null
+Test importing a raw AES-CBC key with legnth 128 and then export it in JWK format
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Importing a key...
+Exporting a key...
+PASS Base64URL.parse(exportedJwkKey.k) is rawKey
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
--- /dev/null
+<!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 raw AES-CBC key with legnth 128 and then export it in JWK format");
+
+jsTestIsAsync = true;
+
+var rawKey = hexStringToUint8Array("909152300357f94c2f64321c2d395370");
+var extractable = true;
+
+debug("Importing a key...");
+crypto.subtle.importKey("raw", rawKey, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]).then(function(cryptoKey) {
+ debug("Exporting a key...");
+ return crypto.subtle.exportKey("jwk", cryptoKey);
+}).then(function(result) {
+ exportedJwkKey = result;
+
+ shouldBe("Base64URL.parse(exportedJwkKey.k)", "rawKey");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+Test importing a raw AES-CBC key with legnth 128 and then export it in raw format
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Importing a key...
+Exporting a key...
+PASS exportedRawKey is rawKey
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
--- /dev/null
+<!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 raw AES-CBC key with legnth 128 and then export it in raw format");
+
+jsTestIsAsync = true;
+
+var rawKey = hexStringToUint8Array("909152300357f94c2f64321c2d395370");
+var extractable = true;
+
+debug("Importing a key...");
+crypto.subtle.importKey("raw", rawKey, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]).then(function(cryptoKey) {
+ debug("Exporting a key...");
+ return crypto.subtle.exportKey("raw", cryptoKey);
+}).then(function(result) {
+ exportedRawKey = new Uint8Array(result);
+
+ shouldBe("exportedRawKey", "rawKey");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+Test importing a JWK HMAC key with SHA-1 and then export it in JWK format
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Importing a key...
+Exporting a key...
+PASS exportedJwkKey.kty is jwkKey.kty
+PASS exportedJwkKey.k is jwkKey.k
+PASS exportedJwkKey.alg is jwkKey.alg
+PASS exportedJwkKey.key_ops is jwkKey.key_ops
+PASS exportedJwkKey.ext is jwkKey.ext
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
--- /dev/null
+<!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 HMAC key with SHA-1 and then export it in JWK format");
+
+jsTestIsAsync = true;
+
+var jwkKey = {
+ kty: "oct",
+ k: "vgJ5AXWT3Fm2w_zZCRF4UVwo53rIhwqLm6b9Tq4m1c53dr94eqPlxt99yb9RCjCFDa2C56K448xe4V964xFucg",
+ alg: "HS1",
+ key_ops: ["sign", "verify"],
+ ext: true,
+};
+var extractable = true;
+
+debug("Importing a key...");
+crypto.subtle.importKey("jwk", jwkKey, {name: "hmac", hash: "sha-1"}, extractable, ["sign", "verify"]).then(function(cryptoKey) {
+ debug("Exporting a key...");
+ return crypto.subtle.exportKey("jwk", cryptoKey);
+}).then(function(result) {
+ exportedJwkKey = result;
+
+ shouldBe("exportedJwkKey.kty", "jwkKey.kty");
+ shouldBe("exportedJwkKey.k", "jwkKey.k");
+ shouldBe("exportedJwkKey.alg", "jwkKey.alg");
+ shouldBe("exportedJwkKey.key_ops", "jwkKey.key_ops");
+ shouldBe("exportedJwkKey.ext", "jwkKey.ext");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
--- /dev/null
+Test importing a JWK HMAC key with SHA-1 and then export it in raw format
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Importing a key...
+Exporting a key...
+PASS Base64URL.stringify(exportedRawKey) is jwkKey.k
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
--- /dev/null
+<!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 HMAC key with SHA-1 and then export it in raw format");
+
+jsTestIsAsync = true;
+
+var jwkKey = {
+ kty: "oct",
+ k: "vgJ5AXWT3Fm2w_zZCRF4UVwo53rIhwqLm6b9Tq4m1c53dr94eqPlxt99yb9RCjCFDa2C56K448xe4V964xFucg",
+ alg: "HS1",
+ key_ops: ["sign", "verify"],
+ ext: true,
+};
+var extractable = true;
+
+debug("Importing a key...");
+crypto.subtle.importKey("jwk", jwkKey, {name: "hmac", hash: "sha-1"}, extractable, ["sign", "verify"]).then(function(cryptoKey) {
+ debug("Exporting a key...");
+ return crypto.subtle.exportKey("raw", cryptoKey);
+}).then(function(result) {
+ exportedRawKey = new Uint8Array(result);
+
+ shouldBe("Base64URL.stringify(exportedRawKey)", "jwkKey.k");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
--- /dev/null
+Test importing a raw HMAC key with SHA-1 and then export it in JWK format
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Importing a key...
+Exporting a key...
+PASS Base64URL.parse(exportedJwkKey.k) is rawKey
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
--- /dev/null
+<!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 raw HMAC key with SHA-1 and then export it in JWK format");
+
+jsTestIsAsync = true;
+
+var rawKey = hexStringToUint8Array("192ff1e96a1399322db620760a738793ab6dfaf26bd2b3889bd81fc9d82ea25d11bb1b4763c0a9259512298e162dab2e6f505c9fc376fda1179a2a4055dd67f6");
+var extractable = true;
+
+debug("Importing a key...");
+crypto.subtle.importKey("raw", rawKey, {name: "hmac", hash: "sha-1"}, extractable, ["sign", "verify"]).then(function(cryptoKey) {
+ debug("Exporting a key...");
+ return crypto.subtle.exportKey("jwk", cryptoKey);
+}).then(function(result) {
+ exportedJwkKey = result;
+
+ shouldBe("Base64URL.parse(exportedJwkKey.k)", "rawKey");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+Test importing a raw HMAC key with SHA-1 and then export it in raw format
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Importing a key...
+Exporting a key...
+PASS exportedRawKey is rawKey
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
--- /dev/null
+<!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 raw HMAC key with SHA-1 and then export it in raw format");
+
+jsTestIsAsync = true;
+
+var rawKey = hexStringToUint8Array("192ff1e96a1399322db620760a738793ab6dfaf26bd2b3889bd81fc9d82ea25d11bb1b4763c0a9259512298e162dab2e6f505c9fc376fda1179a2a4055dd67f6");
+var extractable = true;
+
+debug("Importing a key...");
+crypto.subtle.importKey("raw", rawKey, {name: "hmac", hash: "sha-1"}, extractable, ["sign", "verify"]).then(function(cryptoKey) {
+ debug("Exporting a key...");
+ return crypto.subtle.exportKey("raw", cryptoKey);
+}).then(function(result) {
+ exportedRawKey = new Uint8Array(result);
+
+ shouldBe("exportedRawKey", "rawKey");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+Test importing a JWK RSA-OAEP public key with SHA-1 and then export it in JWK format
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Importing a key...
+Exporting a key...
+PASS exportedJwkKey.kty is jwkKey.kty
+PASS exportedJwkKey.alg is jwkKey.alg
+PASS exportedJwkKey.key_ops is jwkKey.key_ops
+PASS exportedJwkKey.ext is jwkKey.ext
+PASS exportedJwkKey.n is jwkKey.n
+PASS exportedJwkKey.e is jwkKey.e
+PASS exportedJwkKey.p is jwkKey.p
+PASS exportedJwkKey.q is jwkKey.q
+PASS exportedJwkKey.dp is jwkKey.dp
+PASS exportedJwkKey.dq is jwkKey.dq
+PASS exportedJwkKey.qi is jwkKey.qi
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
--- /dev/null
+<!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 then export it in JWK format");
+
+jsTestIsAsync = true;
+
+var jwkKey = {
+ kty: "RSA",
+ alg: "RSA-OAEP",
+ key_ops: ["decrypt", "unwrapKey"],
+ ext: true,
+ n: "v_dgJnIz-_l4noBUwEkMAc-TkUXOBXUb4homc5oLYbVKYee51acuc3m26xK-vPD7VMCwEt17ylKW6jiEIEG50cZxzvCnGn2AiaqzVeqmm79htT93aX74yD6lginrtSSky5pasjxLlIzvEEGCC3zuupFyxXmCztY3AXbfcTscgWgSiNrgNzuuxtG6tbigc9gEPQj8XgSecr8XXKTqVbwQwh8rOao2rHfe_IjiXwElsTaL2sl3IHIrHx6NVbj54_0HCuo5AZ4ZyJ_bkLVBFe4gO9pIlhVuAHr6adlM83-moDeowYKqU4me_2GR_JspZ3Kif-WEwSY6jJuIn7qXtD5jUw",
+ e: "AQAB",
+ d: "DxvDH4OBf-VkjuT-xpt5LHNP4_Egg-FxrlvshtCq8Ke6EPaR87TSvRfpQ5sYE_rLbSI1OWbhJU1Wv1xvWbKSk2YQ8v6RyE30XeFnd-2d60gmwoMaPN1Xazsy_4mZGYqmxbeCR-Di-fAVqKvfNlRA3cIwzEYB-5F0htL6Rwkl9zE8th1DTuBvqBLoTxYZKLnoCN8YdfTUr-CQOghMafCwi3ltAkZqxNNqP9RRSqfkNCqAKK_23jhXS9yZSes3QEO1LBxDNpdumIk4smpO_iFhxd5I68s8JCDogfNQulmErrYbAk6cAUXNMvpua9ipH-uIw8qgakzKfD6lIQmeFoM7MQ",
+ p: "7uKCNGo6nH5Kk6zz6H6n3LAkKr45IQb1CfyLi6Po-6lxHt2a5bi5CkRH7PNUz3QRYWAkYmlpfvoAqzXhOYIUewvcbzyzTUxpv-F1Xbw9KV6nc1LFe8W8733AzLtHBgjimwU9VYgsmV7DJDP7djODjskSGPC9O9rcq7jK_1atFy8",
+ q: "zbhQdf5AX_ssgZALSFhMmvR39c2XJXBLFuAF_c1EBRtch3X-_DgHiZ1srZrdIbnI7yjx7smJPg1Met1pHTgrk9jdlGwkzxFQWgo5XbhergrB7njOtWmkTUlpd01zidk0Nh138KTCchVe7h4JKy7wIomw9256B3ozh0DuP7eIrR0",
+ dp: "C5HAyJUUfZvINNq9fVcU_iUxuzg3QBg8Kd2nTH4FvJp6Ngp5hAKsQ4kHCrzGML3oUZT8bh-40kN9YM1dORHJuCPc6y4_aND4lihvLLj_JU_GQFmT4uiyu86VVdUEHZC0mNlqHQhZUJw8SzaRSSo5huLKE5clMw7ofRCYFEG4ZFU",
+ dq: "axFbpx2N6aZzUndit-Nk81z7Nk4rNUwNeLldxOtZVIMaFFKARErw-Vman3wzTQNBpd-ckxgHOul2_ZdQxuleHNPI9x-VxMORG1uo4bM8a76jkncDtn1mCueDYZlI4dzPBL8vlmpZ3UBsKOgvA2-pgYBCP3UbQ9sBCIrttPHTy60",
+ qi: "o3RcFTK_WfBFceq7ZG3u3imgQkIfRWZorEAKBffBNw0ggh7XjKKNx_dAinTmCE_UlNih-kO9UPTPEI3QyB3i_BIxcm122Ldzot-9Q7H-hsQ6p7AODSlc3xfYNQEG5PjEsDBBG_GlybmDeblhr67s2hDPEmMgAuoXNHxf4QMvmqM",
+};
+var extractable = true;
+
+debug("Importing a key...");
+crypto.subtle.importKey("jwk", jwkKey, {name: "RSA-OAEP", hash: "sha-1"}, extractable, ["decrypt", "unwrapKey"]).then(function(cryptoKey) {
+ debug("Exporting a key...");
+ return crypto.subtle.exportKey("jwk", cryptoKey);
+}).then(function(result) {
+ exportedJwkKey = result;
+
+ shouldBe("exportedJwkKey.kty", "jwkKey.kty");
+ shouldBe("exportedJwkKey.alg", "jwkKey.alg");
+ shouldBe("exportedJwkKey.key_ops", "jwkKey.key_ops");
+ shouldBe("exportedJwkKey.ext", "jwkKey.ext");
+ shouldBe("exportedJwkKey.n", "jwkKey.n");
+ shouldBe("exportedJwkKey.e", "jwkKey.e");
+ // FIXME: Since we actually recaculate the private exponent based on modulus, public exponent, first prime factor, and second prime factor,
+ // this exported private exponent may not match the imported one.
+ // shouldBe("exportedJwkKey.d", "jwkKey.d");
+ shouldBe("exportedJwkKey.p", "jwkKey.p");
+ shouldBe("exportedJwkKey.q", "jwkKey.q");
+ shouldBe("exportedJwkKey.dp", "jwkKey.dp");
+ shouldBe("exportedJwkKey.dq", "jwkKey.dq");
+ shouldBe("exportedJwkKey.qi", "jwkKey.qi");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
--- /dev/null
+Test importing a JWK RSA-OAEP public key with SHA-1 and then export it in JWK format
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Importing a key...
+Exporting a key...
+PASS exportedJwkKey.kty is jwkKey.kty
+PASS exportedJwkKey.alg is jwkKey.alg
+PASS exportedJwkKey.key_ops is jwkKey.key_ops
+PASS exportedJwkKey.ext is jwkKey.ext
+PASS exportedJwkKey.n is jwkKey.n
+PASS exportedJwkKey.e is jwkKey.e
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
--- /dev/null
+<!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 then export it in JWK format");
+
+jsTestIsAsync = true;
+
+var jwkKey = {
+ kty: "RSA",
+ alg: "RSA-OAEP",
+ key_ops: ["encrypt", "wrapKey"],
+ ext: true,
+ n: "p55Xl-DyqKL06TE8GCuXd_e-ruTqVB19iDH6DwTIknTyM0fl8EY6qsyOBNTxjpLDsOldEJ8QblG78WY7xYTZtNn-fimz5eG80bwSZ6FUO10z3ikeKzPPC7K4AA196rMoiEu2G4mSfqeg5zz6_iqHf8u_md_n8yk_iPaXJ9RVT-W4zEQQ6WSlsOtYa7blSSAlq0JYDJciNeE0RGqUU-UjcxUWIEnT2ODHGRzSfKHgc8O3fGt4dpVm0op1yItBcSAY-0_f1p_YrVDo8bsyq2uodyDGYhcuQgYJ0NjMgT_rb8rUPpR3bUitd-IZJd_NO9i_NmvbnQfgl6kfnxe_2kM4Tw",
+ e: "AQAB"
+};
+var extractable = true;
+
+debug("Importing a key...");
+crypto.subtle.importKey("jwk", jwkKey, {name: "RSA-OAEP", hash: "sha-1"}, extractable, ["encrypt", "wrapKey"]).then(function(cryptoKey) {
+ debug("Exporting a key...");
+ return crypto.subtle.exportKey("jwk", cryptoKey);
+}).then(function(result) {
+ exportedJwkKey = result;
+
+ shouldBe("exportedJwkKey.kty", "jwkKey.kty");
+ shouldBe("exportedJwkKey.alg", "jwkKey.alg");
+ shouldBe("exportedJwkKey.key_ops", "jwkKey.key_ops");
+ shouldBe("exportedJwkKey.ext", "jwkKey.ext");
+ shouldBe("exportedJwkKey.n", "jwkKey.n");
+ shouldBe("exportedJwkKey.e", "jwkKey.e");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
+2016-11-16 Jiewen Tan <jiewen_tan@apple.com>
+
+ Add more tests for SubtleCrypto::importKey and SubtleCrypto::exportKey
+ https://bugs.webkit.org/show_bug.cgi?id=164815
+ <rdar://problem/29281660>
+
+ Reviewed by Brent Fulgham.
+
+ Tests: crypto/subtle/aes-import-jwk-key-export-jwk-key.html
+ crypto/subtle/aes-import-jwk-key-export-raw-key.html
+ crypto/subtle/aes-import-raw-key-export-jwk-key.html
+ crypto/subtle/aes-import-raw-key-export-raw-key.html
+ crypto/subtle/hmac-import-jwk-key-export-jwk-key.html
+ crypto/subtle/hmac-import-jwk-key-export-raw-key.html
+ crypto/subtle/hmac-import-raw-key-export-jwk-key.html
+ crypto/subtle/hmac-import-raw-key-export-raw-key.html
+ crypto/subtle/rsa-import-jwk-key-export-jwk-key-private.html
+ crypto/subtle/rsa-import-jwk-key-export-jwk-key-public.html
+
+ * crypto/mac/CryptoKeyRSAMac.cpp:
+ (WebCore::CryptoKeyRSA::create):
+ Add a comment.
+
2016-11-16 Antti Koivisto <antti@apple.com>
Remove getMutableCachedPseudoStyle
return nullptr;
}
CCRSACryptorRef cryptor;
+ // FIXME: It is so weired that we recaculate the private exponent from first prime factor and second prime factor,
+ // given the fact that we have already had it. Also, the re-caculated private exponent may not match the given one.
+ // See <rdar://problem/15452324>.
CCCryptorStatus status = CCRSACryptorCreateFromData(
keyData.type() == CryptoKeyDataRSAComponents::Type::Public ? ccRSAKeyPublic : ccRSAKeyPrivate,
(uint8_t*)keyData.modulus().data(), keyData.modulus().size(),