Changeset 213560 in webkit
- Timestamp:
- Mar 7, 2017 6:09:38 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 51 added
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r213554 r213560 1 2017-03-07 Jiewen Tan <jiewen_tan@apple.com> 2 3 [WebCrypto] Implement ECDH ImportKey/ExportKey operations 4 https://bugs.webkit.org/show_bug.cgi?id=169257 5 <rdar://problem/23789585> 6 7 Reviewed by Brent Fulgham. 8 9 * crypto/subtle/ec-export-key-malformed-parameters-expected.txt: Added. 10 * crypto/subtle/ec-export-key-malformed-parameters.html: Added. 11 * crypto/subtle/ec-import-jwk-key-export-jwk-key-private-expected.txt: Added. 12 * crypto/subtle/ec-import-jwk-key-export-jwk-key-private.html: Added. 13 * crypto/subtle/ec-import-jwk-key-export-jwk-key-public-expected.txt: Added. 14 * crypto/subtle/ec-import-jwk-key-export-jwk-key-public.html: Added. 15 * crypto/subtle/ec-import-jwk-key-export-raw-key-expected.txt: Added. 16 * crypto/subtle/ec-import-jwk-key-export-raw-key.html: Added. 17 * crypto/subtle/ec-import-key-malformed-parameters-expected.txt: Added. 18 * crypto/subtle/ec-import-key-malformed-parameters.html: Added. 19 * crypto/subtle/ec-import-raw-key-export-jwk-key-expected.txt: Added. 20 * crypto/subtle/ec-import-raw-key-export-jwk-key.html: Added. 21 * crypto/subtle/ec-import-raw-key-export-raw-key-expected.txt: Added. 22 * crypto/subtle/ec-import-raw-key-export-raw-key.html: Added. 23 * crypto/subtle/ecdh-generate-export-jwk-key-p256-expected.txt: Added. 24 * crypto/subtle/ecdh-generate-export-jwk-key-p256.html: Added. 25 * crypto/subtle/ecdh-generate-export-jwk-key-p384-expected.txt: Added. 26 * crypto/subtle/ecdh-generate-export-jwk-key-p384.html: Added. 27 * crypto/subtle/ecdh-generate-export-key-raw-p256-expected.txt: Added. 28 * crypto/subtle/ecdh-generate-export-key-raw-p256.html: Added. 29 * crypto/subtle/ecdh-generate-export-key-raw-p384-expected.txt: Added. 30 * crypto/subtle/ecdh-generate-export-key-raw-p384.html: Added. 31 * crypto/subtle/ecdh-import-jwk-key-minimum-expected.txt: Added. 32 * crypto/subtle/ecdh-import-jwk-key-minimum.html: Added. 33 * crypto/subtle/ecdh-import-jwk-private-key-p256-expected.txt: Added. 34 * crypto/subtle/ecdh-import-jwk-private-key-p256.html: Added. 35 * crypto/subtle/ecdh-import-jwk-private-key-p384-expected.txt: Added. 36 * crypto/subtle/ecdh-import-jwk-private-key-p384.html: Added. 37 * crypto/subtle/ecdh-import-jwk-public-key-p256-expected.txt: Added. 38 * crypto/subtle/ecdh-import-jwk-public-key-p256.html: Added. 39 * crypto/subtle/ecdh-import-jwk-public-key-p384-expected.txt: Added. 40 * crypto/subtle/ecdh-import-jwk-public-key-p384.html: Added. 41 * crypto/subtle/ecdh-import-raw-key-p256-expected.txt: Added. 42 * crypto/subtle/ecdh-import-raw-key-p256.html: Added. 43 * crypto/subtle/ecdh-import-raw-key-p384-expected.txt: Added. 44 * crypto/subtle/ecdh-import-raw-key-p384.html: Added. 45 * crypto/subtle/hmac-import-key-malformed-parameters-expected.txt: 46 * crypto/subtle/hmac-import-key-malformed-parameters.html: 47 * crypto/subtle/rsa-import-key-malformed-parameters-expected.txt: 48 * crypto/subtle/rsa-import-key-malformed-parameters.html: 49 Fixed some minor bugs. 50 * crypto/workers/subtle/ec-generate-export-jwk-key-expected.txt: Added. 51 * crypto/workers/subtle/ec-generate-export-jwk-key.html: Added. 52 * crypto/workers/subtle/ec-generate-export-raw-key-expected.txt: Added. 53 * crypto/workers/subtle/ec-generate-export-raw-key.html: Added. 54 * crypto/workers/subtle/ec-import-jwk-key-private-expected.txt: Added. 55 * crypto/workers/subtle/ec-import-jwk-key-private.html: Added. 56 * crypto/workers/subtle/ec-import-jwk-key-public-expected.txt: Added. 57 * crypto/workers/subtle/ec-import-jwk-key-public.html: Added. 58 * crypto/workers/subtle/ec-import-raw-key-expected.txt: Added. 59 * crypto/workers/subtle/ec-import-raw-key.html: Added. 60 * crypto/workers/subtle/resources/ec-generate-export-jwk-key.js: Added. 61 * crypto/workers/subtle/resources/ec-generate-export-raw-key.js: Added. 62 * crypto/workers/subtle/resources/ec-import-jwk-key-private.js: Added. 63 * crypto/workers/subtle/resources/ec-import-jwk-key-public.js: Added. 64 * crypto/workers/subtle/resources/ec-import-raw-key.js: Added. 65 1 66 2017-03-07 Ryan Haddad <ryanhaddad@apple.com> 2 67 -
trunk/LayoutTests/crypto/subtle/hmac-import-key-malformed-parameters-expected.txt
r212465 r213560 24 24 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k, alg: "HS1", use: ""}, {name: "hmac", hash: "sha-1"}, extractable, ["sign", "verify"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 25 25 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k, alg: "HS1", key_ops: ["sign"]}, {name: "hmac", hash: "sha-1"}, extractable, ["sign", "verify"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 26 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k, alg: "HS1", key_ops: [ ]}, {name: "hmac", hash: "sha-1"}, extractable, ["sign", "verify"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 26 27 PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k, alg: "HS1", ext: false}, {name: "hmac", hash: "sha-1"}, extractable, ["sign", "verify"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 27 28 PASS successfullyParsed is true -
trunk/LayoutTests/crypto/subtle/hmac-import-key-malformed-parameters.html
r212465 r213560 44 44 // Jwk: wrong key_ops 45 45 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k, alg: "HS1", key_ops: ["sign"]}, {name: "hmac", hash: "sha-1"}, extractable, ["sign", "verify"])'); 46 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k, alg: "HS1", key_ops: [ ]}, {name: "hmac", hash: "sha-1"}, extractable, ["sign", "verify"])'); 46 47 // Jwk: wrong ext 47 48 shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k, alg: "HS1", ext: false}, {name: "hmac", hash: "sha-1"}, extractable, ["sign", "verify"])'); -
trunk/LayoutTests/crypto/subtle/rsa-import-key-malformed-parameters-expected.txt
r212465 r213560 43 43 PASS crypto.subtle.importKey("jwk", {kty: "oct", n: n, e: e}, "RSAES-PKCS1-v1_5", extractable, ["encrypt"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 44 44 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, key_ops: ["sign", "verify"]}, "RSAES-PKCS1-v1_5", extractable, ["encrypt"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 45 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, key_ops: [ ]}, "RSAES-PKCS1-v1_5", extractable, ["encrypt"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 45 46 PASS crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, ext: false}, "RSAES-PKCS1-v1_5", extractable, ["encrypt"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. 46 47 PASS crypto.subtle.importKey("jwk", {kty: "RSA"}, "RSAES-PKCS1-v1_5", extractable, ["encrypt"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements. -
trunk/LayoutTests/crypto/subtle/rsa-import-key-malformed-parameters.html
r212465 r213560 77 77 // Jwk: Wrong key_ops 78 78 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, key_ops: ["sign", "verify"]}, "RSAES-PKCS1-v1_5", extractable, ["encrypt"])'); 79 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, key_ops: [ ]}, "RSAES-PKCS1-v1_5", extractable, ["encrypt"])'); 79 80 // Jwk: Wrong ext 80 81 shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e, ext: false}, "RSAES-PKCS1-v1_5", extractable, ["encrypt"])'); -
trunk/LayoutTests/imported/w3c/ChangeLog
r213546 r213560 1 2017-03-07 Jiewen Tan <jiewen_tan@apple.com> 2 3 [WebCrypto] Implement ECDH ImportKey/ExportKey operations 4 https://bugs.webkit.org/show_bug.cgi?id=169257 5 <rdar://problem/23789585> 6 7 Reviewed by Brent Fulgham. 8 9 * web-platform-tests/WebCryptoAPI/import_export/ec_importKey.worker-expected.txt: 10 * web-platform-tests/WebCryptoAPI/import_export/test_ec_importKey-expected.txt: 11 1 12 2017-03-07 Alex Christensen <achristensen@webkit.org> 2 13 -
trunk/LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/import_export/ec_importKey.worker-expected.txt
r212124 r213560 24 24 FAIL Good parameters: P-521 bits (pkcs8, buffer(241), {name: ECDSA, namedCurve: P-521}, false, [sign]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 25 25 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y, d), {name: ECDSA, namedCurve: P-521}, false, [sign]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 26 FAIL Good parameters: P-256 bits (spki, buffer(91), {name: ECDH, namedCurve: P-256}, true, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code27 FAIL Good parameters: P-256 bits (jwk, object(kty, crv, x, y), {name: ECDH, namedCurve: P-256}, true, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 28 FAIL Good parameters: P-256 bits (pkcs8, buffer(138), {name: ECDH, namedCurve: P-256}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code29 FAIL Good parameters: P-256 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-256}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 30 FAIL Good parameters: P-256 bits (pkcs8, buffer(138), {name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code31 FAIL Good parameters: P-256 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 32 FAIL Good parameters: P-256 bits (pkcs8, buffer(138), {name: ECDH, namedCurve: P-256}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code33 FAIL Good parameters: P-256 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-256}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 34 FAIL Good parameters: P-256 bits (spki, buffer(91), {name: ECDH, namedCurve: P-256}, false, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code35 FAIL Good parameters: P-256 bits (jwk, object(kty, crv, x, y), {name: ECDH, namedCurve: P-256}, false, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 36 FAIL Good parameters: P-256 bits (pkcs8, buffer(138), {name: ECDH, namedCurve: P-256}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code37 FAIL Good parameters: P-256 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-256}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 38 FAIL Good parameters: P-256 bits (pkcs8, buffer(138), {name: ECDH, namedCurve: P-256}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code39 FAIL Good parameters: P-256 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-256}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 40 FAIL Good parameters: P-256 bits (pkcs8, buffer(138), {name: ECDH, namedCurve: P-256}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code41 FAIL Good parameters: P-256 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-256}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 42 FAIL Good parameters: P-384 bits (spki, buffer(120), {name: ECDH, namedCurve: P-384}, true, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code43 FAIL Good parameters: P-384 bits (jwk, object(kty, crv, x, y), {name: ECDH, namedCurve: P-384}, true, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 44 FAIL Good parameters: P-384 bits (pkcs8, buffer(185), {name: ECDH, namedCurve: P-384}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code45 FAIL Good parameters: P-384 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-384}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 46 FAIL Good parameters: P-384 bits (pkcs8, buffer(185), {name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code47 FAIL Good parameters: P-384 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 48 FAIL Good parameters: P-384 bits (pkcs8, buffer(185), {name: ECDH, namedCurve: P-384}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code49 FAIL Good parameters: P-384 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-384}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 50 FAIL Good parameters: P-384 bits (spki, buffer(120), {name: ECDH, namedCurve: P-384}, false, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code51 FAIL Good parameters: P-384 bits (jwk, object(kty, crv, x, y), {name: ECDH, namedCurve: P-384}, false, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 52 FAIL Good parameters: P-384 bits (pkcs8, buffer(185), {name: ECDH, namedCurve: P-384}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code53 FAIL Good parameters: P-384 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-384}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 54 FAIL Good parameters: P-384 bits (pkcs8, buffer(185), {name: ECDH, namedCurve: P-384}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code55 FAIL Good parameters: P-384 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-384}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 56 FAIL Good parameters: P-384 bits (pkcs8, buffer(185), {name: ECDH, namedCurve: P-384}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code57 FAIL Good parameters: P-384 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-384}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 58 FAIL Good parameters: P-521 bits (spki, buffer(158), {name: ECDH, namedCurve: P-521}, true, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code59 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y), {name: ECDH, namedCurve: P-521}, true, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code60 FAIL Good parameters: P-521 bits (pkcs8, buffer(241), {name: ECDH, namedCurve: P-521}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code61 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-521}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code62 FAIL Good parameters: P-521 bits (pkcs8, buffer(241), {name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code63 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code64 FAIL Good parameters: P-521 bits (pkcs8, buffer(241), {name: ECDH, namedCurve: P-521}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code65 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-521}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code66 FAIL Good parameters: P-521 bits (spki, buffer(158), {name: ECDH, namedCurve: P-521}, false, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code67 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y), {name: ECDH, namedCurve: P-521}, false, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code68 FAIL Good parameters: P-521 bits (pkcs8, buffer(241), {name: ECDH, namedCurve: P-521}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code69 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-521}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code70 FAIL Good parameters: P-521 bits (pkcs8, buffer(241), {name: ECDH, namedCurve: P-521}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code71 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-521}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code72 FAIL Good parameters: P-521 bits (pkcs8, buffer(241), {name: ECDH, namedCurve: P-521}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code73 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-521}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code26 FAIL Good parameters: P-256 bits (spki, buffer(91), {name: ECDH, namedCurve: P-256}, true, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 27 PASS Good parameters: P-256 bits (jwk, object(kty, crv, x, y), {name: ECDH, namedCurve: P-256}, true, []) 28 FAIL Good parameters: P-256 bits (pkcs8, buffer(138), {name: ECDH, namedCurve: P-256}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 29 PASS Good parameters: P-256 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-256}, true, [deriveKey]) 30 FAIL Good parameters: P-256 bits (pkcs8, buffer(138), {name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 31 PASS Good parameters: P-256 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey]) 32 FAIL Good parameters: P-256 bits (pkcs8, buffer(138), {name: ECDH, namedCurve: P-256}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 33 PASS Good parameters: P-256 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-256}, true, [deriveBits]) 34 FAIL Good parameters: P-256 bits (spki, buffer(91), {name: ECDH, namedCurve: P-256}, false, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 35 PASS Good parameters: P-256 bits (jwk, object(kty, crv, x, y), {name: ECDH, namedCurve: P-256}, false, []) 36 FAIL Good parameters: P-256 bits (pkcs8, buffer(138), {name: ECDH, namedCurve: P-256}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 37 PASS Good parameters: P-256 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-256}, false, [deriveKey]) 38 FAIL Good parameters: P-256 bits (pkcs8, buffer(138), {name: ECDH, namedCurve: P-256}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 39 PASS Good parameters: P-256 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-256}, false, [deriveBits, deriveKey]) 40 FAIL Good parameters: P-256 bits (pkcs8, buffer(138), {name: ECDH, namedCurve: P-256}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 41 PASS Good parameters: P-256 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-256}, false, [deriveBits]) 42 FAIL Good parameters: P-384 bits (spki, buffer(120), {name: ECDH, namedCurve: P-384}, true, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 43 PASS Good parameters: P-384 bits (jwk, object(kty, crv, x, y), {name: ECDH, namedCurve: P-384}, true, []) 44 FAIL Good parameters: P-384 bits (pkcs8, buffer(185), {name: ECDH, namedCurve: P-384}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 45 PASS Good parameters: P-384 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-384}, true, [deriveKey]) 46 FAIL Good parameters: P-384 bits (pkcs8, buffer(185), {name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 47 PASS Good parameters: P-384 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey]) 48 FAIL Good parameters: P-384 bits (pkcs8, buffer(185), {name: ECDH, namedCurve: P-384}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 49 PASS Good parameters: P-384 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-384}, true, [deriveBits]) 50 FAIL Good parameters: P-384 bits (spki, buffer(120), {name: ECDH, namedCurve: P-384}, false, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 51 PASS Good parameters: P-384 bits (jwk, object(kty, crv, x, y), {name: ECDH, namedCurve: P-384}, false, []) 52 FAIL Good parameters: P-384 bits (pkcs8, buffer(185), {name: ECDH, namedCurve: P-384}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 53 PASS Good parameters: P-384 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-384}, false, [deriveKey]) 54 FAIL Good parameters: P-384 bits (pkcs8, buffer(185), {name: ECDH, namedCurve: P-384}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 55 PASS Good parameters: P-384 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-384}, false, [deriveBits, deriveKey]) 56 FAIL Good parameters: P-384 bits (pkcs8, buffer(185), {name: ECDH, namedCurve: P-384}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 57 PASS Good parameters: P-384 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-384}, false, [deriveBits]) 58 FAIL Good parameters: P-521 bits (spki, buffer(158), {name: ECDH, namedCurve: P-521}, true, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 59 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y), {name: ECDH, namedCurve: P-521}, true, []) assert_unreached: Threw an unexpected error: DataError (DOM Exception 30): Data provided to an operation does not meet requirements Reached unreachable code 60 FAIL Good parameters: P-521 bits (pkcs8, buffer(241), {name: ECDH, namedCurve: P-521}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 61 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-521}, true, [deriveKey]) assert_unreached: Threw an unexpected error: DataError (DOM Exception 30): Data provided to an operation does not meet requirements Reached unreachable code 62 FAIL Good parameters: P-521 bits (pkcs8, buffer(241), {name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 63 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: DataError (DOM Exception 30): Data provided to an operation does not meet requirements Reached unreachable code 64 FAIL Good parameters: P-521 bits (pkcs8, buffer(241), {name: ECDH, namedCurve: P-521}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 65 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-521}, true, [deriveBits]) assert_unreached: Threw an unexpected error: DataError (DOM Exception 30): Data provided to an operation does not meet requirements Reached unreachable code 66 FAIL Good parameters: P-521 bits (spki, buffer(158), {name: ECDH, namedCurve: P-521}, false, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 67 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y), {name: ECDH, namedCurve: P-521}, false, []) assert_unreached: Threw an unexpected error: DataError (DOM Exception 30): Data provided to an operation does not meet requirements Reached unreachable code 68 FAIL Good parameters: P-521 bits (pkcs8, buffer(241), {name: ECDH, namedCurve: P-521}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 69 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-521}, false, [deriveKey]) assert_unreached: Threw an unexpected error: DataError (DOM Exception 30): Data provided to an operation does not meet requirements Reached unreachable code 70 FAIL Good parameters: P-521 bits (pkcs8, buffer(241), {name: ECDH, namedCurve: P-521}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 71 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-521}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: DataError (DOM Exception 30): Data provided to an operation does not meet requirements Reached unreachable code 72 FAIL Good parameters: P-521 bits (pkcs8, buffer(241), {name: ECDH, namedCurve: P-521}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 73 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-521}, false, [deriveBits]) assert_unreached: Threw an unexpected error: DataError (DOM Exception 30): Data provided to an operation does not meet requirements Reached unreachable code 74 74 -
trunk/LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/import_export/test_ec_importKey-expected.txt
r212124 r213560 24 24 FAIL Good parameters: P-521 bits (pkcs8, buffer(241), {name: ECDSA, namedCurve: P-521}, false, [sign]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 25 25 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y, d), {name: ECDSA, namedCurve: P-521}, false, [sign]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 26 FAIL Good parameters: P-256 bits (spki, buffer(91), {name: ECDH, namedCurve: P-256}, true, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code27 FAIL Good parameters: P-256 bits (jwk, object(kty, crv, x, y), {name: ECDH, namedCurve: P-256}, true, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 28 FAIL Good parameters: P-256 bits (pkcs8, buffer(138), {name: ECDH, namedCurve: P-256}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code29 FAIL Good parameters: P-256 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-256}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 30 FAIL Good parameters: P-256 bits (pkcs8, buffer(138), {name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code31 FAIL Good parameters: P-256 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 32 FAIL Good parameters: P-256 bits (pkcs8, buffer(138), {name: ECDH, namedCurve: P-256}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code33 FAIL Good parameters: P-256 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-256}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 34 FAIL Good parameters: P-256 bits (spki, buffer(91), {name: ECDH, namedCurve: P-256}, false, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code35 FAIL Good parameters: P-256 bits (jwk, object(kty, crv, x, y), {name: ECDH, namedCurve: P-256}, false, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 36 FAIL Good parameters: P-256 bits (pkcs8, buffer(138), {name: ECDH, namedCurve: P-256}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code37 FAIL Good parameters: P-256 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-256}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 38 FAIL Good parameters: P-256 bits (pkcs8, buffer(138), {name: ECDH, namedCurve: P-256}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code39 FAIL Good parameters: P-256 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-256}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 40 FAIL Good parameters: P-256 bits (pkcs8, buffer(138), {name: ECDH, namedCurve: P-256}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code41 FAIL Good parameters: P-256 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-256}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 42 FAIL Good parameters: P-384 bits (spki, buffer(120), {name: ECDH, namedCurve: P-384}, true, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code43 FAIL Good parameters: P-384 bits (jwk, object(kty, crv, x, y), {name: ECDH, namedCurve: P-384}, true, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 44 FAIL Good parameters: P-384 bits (pkcs8, buffer(185), {name: ECDH, namedCurve: P-384}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code45 FAIL Good parameters: P-384 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-384}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 46 FAIL Good parameters: P-384 bits (pkcs8, buffer(185), {name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code47 FAIL Good parameters: P-384 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 48 FAIL Good parameters: P-384 bits (pkcs8, buffer(185), {name: ECDH, namedCurve: P-384}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code49 FAIL Good parameters: P-384 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-384}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 50 FAIL Good parameters: P-384 bits (spki, buffer(120), {name: ECDH, namedCurve: P-384}, false, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code51 FAIL Good parameters: P-384 bits (jwk, object(kty, crv, x, y), {name: ECDH, namedCurve: P-384}, false, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 52 FAIL Good parameters: P-384 bits (pkcs8, buffer(185), {name: ECDH, namedCurve: P-384}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code53 FAIL Good parameters: P-384 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-384}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 54 FAIL Good parameters: P-384 bits (pkcs8, buffer(185), {name: ECDH, namedCurve: P-384}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code55 FAIL Good parameters: P-384 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-384}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 56 FAIL Good parameters: P-384 bits (pkcs8, buffer(185), {name: ECDH, namedCurve: P-384}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code57 FAIL Good parameters: P-384 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-384}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code 58 FAIL Good parameters: P-521 bits (spki, buffer(158), {name: ECDH, namedCurve: P-521}, true, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code59 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y), {name: ECDH, namedCurve: P-521}, true, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code60 FAIL Good parameters: P-521 bits (pkcs8, buffer(241), {name: ECDH, namedCurve: P-521}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code61 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-521}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code62 FAIL Good parameters: P-521 bits (pkcs8, buffer(241), {name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code63 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code64 FAIL Good parameters: P-521 bits (pkcs8, buffer(241), {name: ECDH, namedCurve: P-521}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code65 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-521}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code66 FAIL Good parameters: P-521 bits (spki, buffer(158), {name: ECDH, namedCurve: P-521}, false, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code67 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y), {name: ECDH, namedCurve: P-521}, false, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code68 FAIL Good parameters: P-521 bits (pkcs8, buffer(241), {name: ECDH, namedCurve: P-521}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code69 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-521}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code70 FAIL Good parameters: P-521 bits (pkcs8, buffer(241), {name: ECDH, namedCurve: P-521}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code71 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-521}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code72 FAIL Good parameters: P-521 bits (pkcs8, buffer(241), {name: ECDH, namedCurve: P-521}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code73 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-521}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported.Reached unreachable code26 FAIL Good parameters: P-256 bits (spki, buffer(91), {name: ECDH, namedCurve: P-256}, true, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 27 PASS Good parameters: P-256 bits (jwk, object(kty, crv, x, y), {name: ECDH, namedCurve: P-256}, true, []) 28 FAIL Good parameters: P-256 bits (pkcs8, buffer(138), {name: ECDH, namedCurve: P-256}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 29 PASS Good parameters: P-256 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-256}, true, [deriveKey]) 30 FAIL Good parameters: P-256 bits (pkcs8, buffer(138), {name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 31 PASS Good parameters: P-256 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey]) 32 FAIL Good parameters: P-256 bits (pkcs8, buffer(138), {name: ECDH, namedCurve: P-256}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 33 PASS Good parameters: P-256 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-256}, true, [deriveBits]) 34 FAIL Good parameters: P-256 bits (spki, buffer(91), {name: ECDH, namedCurve: P-256}, false, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 35 PASS Good parameters: P-256 bits (jwk, object(kty, crv, x, y), {name: ECDH, namedCurve: P-256}, false, []) 36 FAIL Good parameters: P-256 bits (pkcs8, buffer(138), {name: ECDH, namedCurve: P-256}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 37 PASS Good parameters: P-256 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-256}, false, [deriveKey]) 38 FAIL Good parameters: P-256 bits (pkcs8, buffer(138), {name: ECDH, namedCurve: P-256}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 39 PASS Good parameters: P-256 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-256}, false, [deriveBits, deriveKey]) 40 FAIL Good parameters: P-256 bits (pkcs8, buffer(138), {name: ECDH, namedCurve: P-256}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 41 PASS Good parameters: P-256 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-256}, false, [deriveBits]) 42 FAIL Good parameters: P-384 bits (spki, buffer(120), {name: ECDH, namedCurve: P-384}, true, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 43 PASS Good parameters: P-384 bits (jwk, object(kty, crv, x, y), {name: ECDH, namedCurve: P-384}, true, []) 44 FAIL Good parameters: P-384 bits (pkcs8, buffer(185), {name: ECDH, namedCurve: P-384}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 45 PASS Good parameters: P-384 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-384}, true, [deriveKey]) 46 FAIL Good parameters: P-384 bits (pkcs8, buffer(185), {name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 47 PASS Good parameters: P-384 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey]) 48 FAIL Good parameters: P-384 bits (pkcs8, buffer(185), {name: ECDH, namedCurve: P-384}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 49 PASS Good parameters: P-384 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-384}, true, [deriveBits]) 50 FAIL Good parameters: P-384 bits (spki, buffer(120), {name: ECDH, namedCurve: P-384}, false, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 51 PASS Good parameters: P-384 bits (jwk, object(kty, crv, x, y), {name: ECDH, namedCurve: P-384}, false, []) 52 FAIL Good parameters: P-384 bits (pkcs8, buffer(185), {name: ECDH, namedCurve: P-384}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 53 PASS Good parameters: P-384 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-384}, false, [deriveKey]) 54 FAIL Good parameters: P-384 bits (pkcs8, buffer(185), {name: ECDH, namedCurve: P-384}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 55 PASS Good parameters: P-384 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-384}, false, [deriveBits, deriveKey]) 56 FAIL Good parameters: P-384 bits (pkcs8, buffer(185), {name: ECDH, namedCurve: P-384}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 57 PASS Good parameters: P-384 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-384}, false, [deriveBits]) 58 FAIL Good parameters: P-521 bits (spki, buffer(158), {name: ECDH, namedCurve: P-521}, true, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 59 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y), {name: ECDH, namedCurve: P-521}, true, []) assert_unreached: Threw an unexpected error: DataError (DOM Exception 30): Data provided to an operation does not meet requirements Reached unreachable code 60 FAIL Good parameters: P-521 bits (pkcs8, buffer(241), {name: ECDH, namedCurve: P-521}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 61 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-521}, true, [deriveKey]) assert_unreached: Threw an unexpected error: DataError (DOM Exception 30): Data provided to an operation does not meet requirements Reached unreachable code 62 FAIL Good parameters: P-521 bits (pkcs8, buffer(241), {name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 63 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: DataError (DOM Exception 30): Data provided to an operation does not meet requirements Reached unreachable code 64 FAIL Good parameters: P-521 bits (pkcs8, buffer(241), {name: ECDH, namedCurve: P-521}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 65 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-521}, true, [deriveBits]) assert_unreached: Threw an unexpected error: DataError (DOM Exception 30): Data provided to an operation does not meet requirements Reached unreachable code 66 FAIL Good parameters: P-521 bits (spki, buffer(158), {name: ECDH, namedCurve: P-521}, false, []) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 67 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y), {name: ECDH, namedCurve: P-521}, false, []) assert_unreached: Threw an unexpected error: DataError (DOM Exception 30): Data provided to an operation does not meet requirements Reached unreachable code 68 FAIL Good parameters: P-521 bits (pkcs8, buffer(241), {name: ECDH, namedCurve: P-521}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 69 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-521}, false, [deriveKey]) assert_unreached: Threw an unexpected error: DataError (DOM Exception 30): Data provided to an operation does not meet requirements Reached unreachable code 70 FAIL Good parameters: P-521 bits (pkcs8, buffer(241), {name: ECDH, namedCurve: P-521}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 71 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-521}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: DataError (DOM Exception 30): Data provided to an operation does not meet requirements Reached unreachable code 72 FAIL Good parameters: P-521 bits (pkcs8, buffer(241), {name: ECDH, namedCurve: P-521}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code 73 FAIL Good parameters: P-521 bits (jwk, object(kty, crv, x, y, d), {name: ECDH, namedCurve: P-521}, false, [deriveBits]) assert_unreached: Threw an unexpected error: DataError (DOM Exception 30): Data provided to an operation does not meet requirements Reached unreachable code 74 74 -
trunk/Source/WebCore/ChangeLog
r213558 r213560 1 2017-03-07 Jiewen Tan <jiewen_tan@apple.com> 2 3 [WebCrypto] Implement ECDH ImportKey/ExportKey operations 4 https://bugs.webkit.org/show_bug.cgi?id=169257 5 <rdar://problem/23789585> 6 7 Reviewed by Brent Fulgham. 8 9 This patch implements ECDH ImportKey/ExportKey operations according to: 10 https://www.w3.org/TR/WebCryptoAPI/#ecdh-operations. Sad that we can't 11 support SPKI/PKCS8 formats at this moment due to lack of necessary 12 support in the underlying crypto library. Bug 169318 is tracking the 13 issue. Also, this patch fixes minor bugs while importing JWK keys for 14 HMAC/RSA. 15 16 Tests: crypto/subtle/ec-export-key-malformed-parameters.html 17 crypto/subtle/ec-import-jwk-key-export-jwk-key-private.html 18 crypto/subtle/ec-import-jwk-key-export-jwk-key-public.html 19 crypto/subtle/ec-import-jwk-key-export-raw-key.html 20 crypto/subtle/ec-import-key-malformed-parameters.html 21 crypto/subtle/ec-import-raw-key-export-jwk-key.html 22 crypto/subtle/ec-import-raw-key-export-raw-key.html 23 crypto/subtle/ecdh-generate-export-jwk-key-p256.html 24 crypto/subtle/ecdh-generate-export-jwk-key-p384.html 25 crypto/subtle/ecdh-generate-export-key-raw-p256.html 26 crypto/subtle/ecdh-generate-export-key-raw-p384.html 27 crypto/subtle/ecdh-import-jwk-key-minimum.html 28 crypto/subtle/ecdh-import-jwk-private-key-p256.html 29 crypto/subtle/ecdh-import-jwk-private-key-p384.html 30 crypto/subtle/ecdh-import-jwk-public-key-p256.html 31 crypto/subtle/ecdh-import-jwk-public-key-p384.html 32 crypto/subtle/ecdh-import-raw-key-p256.html 33 crypto/subtle/ecdh-import-raw-key-p384.html 34 crypto/workers/subtle/ec-generate-export-jwk-key.html 35 crypto/workers/subtle/ec-generate-export-raw-key.html 36 crypto/workers/subtle/ec-import-jwk-key-private.html 37 crypto/workers/subtle/ec-import-jwk-key-public.html 38 crypto/workers/subtle/ec-import-raw-key.html 39 40 * bindings/js/JSSubtleCryptoCustom.cpp: 41 (WebCore::normalizeCryptoAlgorithmParameters): 42 (WebCore::supportExportKeyThrow): 43 Added EC family support. 44 * crypto/CommonCryptoUtilities.h: 45 Added needed CommonCrypto SPIs. 46 * crypto/CryptoAlgorithm.h: 47 * crypto/algorithms/CryptoAlgorithmECDH.cpp: 48 (WebCore::CryptoAlgorithmECDH::importKey): 49 (WebCore::CryptoAlgorithmECDH::exportKey): 50 * crypto/algorithms/CryptoAlgorithmECDH.h: 51 * crypto/gnutls/CryptoKeyECGnuTLS.cpp: 52 (WebCore::CryptoKeyEC::keySizeInBits): 53 (WebCore::CryptoKeyEC::exportRaw): 54 (WebCore::CryptoKeyEC::platformImportRaw): 55 (WebCore::CryptoKeyEC::platformImportJWKPublic): 56 (WebCore::CryptoKeyEC::platformImportJWKPrivate): 57 (WebCore::CryptoKeyEC::platformAddFieldElements): 58 Faked implementations for GTK+. 59 * crypto/keys/CryptoKeyEC.cpp: 60 (WebCore::toNamedCurve): 61 (WebCore::CryptoKeyEC::generatePair): 62 (WebCore::CryptoKeyEC::importRaw): 63 (WebCore::CryptoKeyEC::importJwk): 64 (WebCore::CryptoKeyEC::exportJwk): 65 * crypto/keys/CryptoKeyEC.h: 66 * crypto/keys/CryptoKeyHMAC.cpp: 67 (WebCore::CryptoKeyHMAC::importJwk): 68 Fixed a bug. 69 * crypto/keys/CryptoKeyRSA.cpp: 70 (WebCore::CryptoKeyRSA::importJwk): 71 Fixed a bug. 72 * crypto/mac/CryptoKeyECMac.cpp: 73 (WebCore::doesUncompressedPointMatchNamedCurve): 74 (WebCore::doesFieldElementMatchNamedCurve): 75 (WebCore::getKeySizeFromNamedCurve): 76 (WebCore::CryptoKeyEC::~CryptoKeyEC): 77 (WebCore::CryptoKeyEC::keySizeInBits): 78 (WebCore::CryptoKeyEC::exportRaw): 79 (WebCore::CryptoKeyEC::platformGeneratePair): 80 (WebCore::CryptoKeyEC::platformImportRaw): 81 (WebCore::CryptoKeyEC::platformImportJWKPublic): 82 (WebCore::CryptoKeyEC::platformImportJWKPrivate): 83 (WebCore::CryptoKeyEC::platformAddFieldElements): 84 1 85 2017-03-07 Youenn Fablet <youenn@apple.com> 2 86 -
trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp
r213489 r213560 244 244 break; 245 245 } 246 case CryptoAlgorithmIdentifier::ECDSA: 247 case CryptoAlgorithmIdentifier::ECDH: { 248 auto params = convertDictionary<CryptoAlgorithmEcKeyParams>(state, value); 249 RETURN_IF_EXCEPTION(scope, nullptr); 250 result = std::make_unique<CryptoAlgorithmEcKeyParams>(params); 251 break; 252 } 246 253 default: 247 254 throwNotSupportedError(state, scope); … … 416 423 case CryptoAlgorithmIdentifier::AES_KW: 417 424 case CryptoAlgorithmIdentifier::HMAC: 425 case CryptoAlgorithmIdentifier::ECDSA: 426 case CryptoAlgorithmIdentifier::ECDH: 418 427 return; 419 428 default: -
trunk/Source/WebCore/crypto/CommonCryptoUtilities.h
r213489 r213560 87 87 extern "C" CCCryptorStatus CCRSACryptorExport(CCRSACryptorRef key, void *out, size_t *outLen); 88 88 89 #ifndef _CC_ECCRYPTOR_H_ 90 enum { 91 ccECKeyPublic = 0, 92 ccECKeyPrivate = 1, 93 }; 94 typedef uint32_t CCECKeyType; 95 96 enum { 97 kCCImportKeyBinary = 0, 98 }; 99 typedef uint32_t CCECKeyExternalFormat; 100 #endif 101 89 102 typedef struct _CCECCryptor *CCECCryptorRef; 90 103 extern "C" CCCryptorStatus CCECCryptorGeneratePair(size_t keysize, CCECCryptorRef *publicKey, CCECCryptorRef *privateKey); 91 104 extern "C" void CCECCryptorRelease(CCECCryptorRef key); 105 extern "C" CCCryptorStatus CCECCryptorImportKey(CCECKeyExternalFormat format, void *keyPackage, size_t keyPackageLen, CCECKeyType keyType, CCECCryptorRef *key); 106 extern "C" CCCryptorStatus CCECCryptorExportKey(CCECKeyExternalFormat format, void *keyPackage, size_t *keyPackageLen, CCECKeyType keyType, CCECCryptorRef key); 107 extern "C" int CCECGetKeySize(CCECCryptorRef key); 108 extern "C" CCCryptorStatus CCECCryptorCreateFromData(size_t keySize, uint8_t *qX, size_t qXLength, uint8_t *qY, size_t qYLength, CCECCryptorRef *ref); 109 extern "C" CCCryptorStatus CCECCryptorGetKeyComponents(CCECCryptorRef ecKey, size_t *keySize, uint8_t *qX, size_t *qXLength, uint8_t *qY, size_t *qYLength, uint8_t *d, size_t *dLength); 110 92 111 93 112 #if !USE(APPLE_INTERNAL_SDK) -
trunk/Source/WebCore/crypto/CryptoAlgorithm.h
r212736 r213560 73 73 virtual void digest(Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&); 74 74 virtual void generateKey(const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&&, ExceptionCallback&&, ScriptExecutionContext&); 75 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=169262 75 76 virtual void importKey(SubtleCrypto::KeyFormat, KeyData&&, const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&); 76 77 virtual void exportKey(SubtleCrypto::KeyFormat, Ref<CryptoKey>&&, KeyDataCallback&&, ExceptionCallback&&); -
trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmECDH.cpp
r213489 r213560 66 66 } 67 67 68 void CryptoAlgorithmECDH::importKey(SubtleCrypto::KeyFormat format, KeyData&& data, const std::unique_ptr<CryptoAlgorithmParameters>&& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback) 69 { 70 ASSERT(parameters); 71 const auto& ecParameters = downcast<CryptoAlgorithmEcKeyParams>(*parameters); 72 73 RefPtr<CryptoKeyEC> result; 74 switch (format) { 75 case SubtleCrypto::KeyFormat::Jwk: { 76 JsonWebKey key = WTFMove(WTF::get<JsonWebKey>(data)); 77 78 bool isUsagesAllowed = false; 79 if (!key.d.isNull()) { 80 isUsagesAllowed = isUsagesAllowed || !(usages ^ CryptoKeyUsageDeriveKey); 81 isUsagesAllowed = isUsagesAllowed || !(usages ^ CryptoKeyUsageDeriveBits); 82 isUsagesAllowed = isUsagesAllowed || !(usages ^ (CryptoKeyUsageDeriveKey | CryptoKeyUsageDeriveBits)); 83 } 84 isUsagesAllowed = isUsagesAllowed || !usages; 85 if (!isUsagesAllowed) { 86 exceptionCallback(SYNTAX_ERR); 87 return; 88 } 89 90 if (usages && !key.use.isNull() && key.use != "enc") { 91 exceptionCallback(DataError); 92 return; 93 } 94 95 result = CryptoKeyEC::importJwk(ecParameters.identifier, ecParameters.namedCurve, WTFMove(key), extractable, usages); 96 break; 97 } 98 case SubtleCrypto::KeyFormat::Raw: 99 if (usages) { 100 exceptionCallback(SYNTAX_ERR); 101 return; 102 } 103 result = CryptoKeyEC::importRaw(ecParameters.identifier, ecParameters.namedCurve, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages); 104 break; 105 default: 106 exceptionCallback(NOT_SUPPORTED_ERR); 107 return; 108 } 109 if (!result) { 110 exceptionCallback(DataError); 111 return; 112 } 113 114 callback(*result); 115 } 116 117 void CryptoAlgorithmECDH::exportKey(SubtleCrypto::KeyFormat format, Ref<CryptoKey>&& key, KeyDataCallback&& callback, ExceptionCallback&& exceptionCallback) 118 { 119 const auto& ecKey = downcast<CryptoKeyEC>(key.get()); 120 121 if (!ecKey.keySizeInBits()) { 122 exceptionCallback(OperationError); 123 return; 124 } 125 126 KeyData result; 127 switch (format) { 128 case SubtleCrypto::KeyFormat::Jwk: { 129 result = ecKey.exportJwk(); 130 break; 131 } 132 case SubtleCrypto::KeyFormat::Raw: { 133 if (ecKey.type() != CryptoKey::Type::Public) { 134 exceptionCallback(INVALID_ACCESS_ERR); 135 return; 136 } 137 result = ecKey.exportRaw(); 138 break; 139 } 140 default: 141 exceptionCallback(NOT_SUPPORTED_ERR); 142 return; 143 } 144 145 callback(format, WTFMove(result)); 146 } 147 68 148 } // namespace WebCore 69 149 -
trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmECDH.h
r213489 r213560 43 43 44 44 void generateKey(const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&&, ExceptionCallback&&, ScriptExecutionContext&) final; 45 void importKey(SubtleCrypto::KeyFormat, KeyData&&, const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final; 46 void exportKey(SubtleCrypto::KeyFormat, Ref<CryptoKey>&&, KeyDataCallback&&, ExceptionCallback&&) final; 45 47 }; 46 48 -
trunk/Source/WebCore/crypto/gnutls/CryptoKeyECGnuTLS.cpp
r213489 r213560 42 42 } 43 43 44 size_t CryptoKeyEC::keySizeInBits() const 45 { 46 notImplemented(); 47 48 return 0; 49 } 50 51 Vector<uint8_t> CryptoKeyEC::exportRaw() const 52 { 53 notImplemented(); 54 55 return { }; 56 } 57 44 58 std::optional<CryptoKeyPair> CryptoKeyEC::platformGeneratePair(CryptoAlgorithmIdentifier, NamedCurve, bool, CryptoKeyUsageBitmap) 45 59 { … … 49 63 } 50 64 65 RefPtr<CryptoKeyEC> CryptoKeyEC::platformImportRaw(CryptoAlgorithmIdentifier, NamedCurve, Vector<uint8_t>&&, bool, CryptoKeyUsageBitmap) 66 { 67 notImplemented(); 68 69 return nullptr; 70 } 71 72 RefPtr<CryptoKeyEC> CryptoKeyEC::platformImportJWKPublic(CryptoAlgorithmIdentifier, NamedCurve, Vector<uint8_t>&&, Vector<uint8_t>&&, bool, CryptoKeyUsageBitmap) 73 { 74 notImplemented(); 75 76 return nullptr; 77 } 78 79 RefPtr<CryptoKeyEC> CryptoKeyEC::platformImportJWKPrivate(CryptoAlgorithmIdentifier, NamedCurve, Vector<uint8_t>&&, Vector<uint8_t>&&, Vector<uint8_t>&&, bool, CryptoKeyUsageBitmap) 80 { 81 notImplemented(); 82 83 return nullptr; 84 } 85 86 void CryptoKeyEC::platformAddFieldElements(JsonWebKey&) const 87 { 88 notImplemented(); 89 } 90 51 91 } // namespace WebCore 52 92 -
trunk/Source/WebCore/crypto/keys/CryptoKeyEC.cpp
r213489 r213560 32 32 #include "CryptoKeyData.h" 33 33 #include "ExceptionCode.h" 34 #include "JsonWebKey.h" 35 #include <wtf/text/Base64.h> 34 36 35 37 namespace WebCore { … … 37 39 static const char* const P256 = "P-256"; 38 40 static const char* const P384 = "P-384"; 41 42 static std::optional<CryptoKeyEC::NamedCurve> toNamedCurve(const String& curve) 43 { 44 if (curve == P256) 45 return CryptoKeyEC::NamedCurve::P256; 46 if (curve == P384) 47 return CryptoKeyEC::NamedCurve::P384; 48 49 return std::nullopt; 50 } 39 51 40 52 CryptoKeyEC::CryptoKeyEC(CryptoAlgorithmIdentifier identifier, NamedCurve curve, CryptoKeyType type, PlatformECKey platformKey, bool extractable, CryptoKeyUsageBitmap usages) … … 45 57 } 46 58 47 ExceptionOr<CryptoKeyPair> CryptoKeyEC::generatePair(CryptoAlgorithmIdentifier identifier, const String& namedCurve, bool extractable, CryptoKeyUsageBitmap usages)59 ExceptionOr<CryptoKeyPair> CryptoKeyEC::generatePair(CryptoAlgorithmIdentifier identifier, const String& curve, bool extractable, CryptoKeyUsageBitmap usages) 48 60 { 49 NamedCurve curve; 50 if (namedCurve == P256) 51 curve = NamedCurve::P256; 52 else if (namedCurve == P384) 53 curve = NamedCurve::P384; 54 else 61 auto namedCurve = toNamedCurve(curve); 62 if (!namedCurve) 55 63 return Exception { NOT_SUPPORTED_ERR }; 56 64 57 auto result = platformGeneratePair(identifier, curve, extractable, usages);65 auto result = platformGeneratePair(identifier, *namedCurve, extractable, usages); 58 66 if (!result) 59 67 return Exception { OperationError }; 60 68 61 69 return WTFMove(*result); 70 } 71 72 RefPtr<CryptoKeyEC> CryptoKeyEC::importRaw(CryptoAlgorithmIdentifier identifier, const String& curve, Vector<uint8_t>&& keyData, bool extractable, CryptoKeyUsageBitmap usages) 73 { 74 auto namedCurve = toNamedCurve(curve); 75 if (!namedCurve) 76 return nullptr; 77 78 return platformImportRaw(identifier, *namedCurve, WTFMove(keyData), extractable, usages); 79 } 80 81 RefPtr<CryptoKeyEC> CryptoKeyEC::importJwk(CryptoAlgorithmIdentifier identifier, const String& curve, JsonWebKey&& keyData, bool extractable, CryptoKeyUsageBitmap usages) 82 { 83 if (keyData.kty != "EC") 84 return nullptr; 85 if (keyData.key_ops && ((keyData.usages & usages) != usages)) 86 return nullptr; 87 if (keyData.ext && !keyData.ext.value() && extractable) 88 return nullptr; 89 90 if (keyData.crv.isNull() || curve != keyData.crv) 91 return nullptr; 92 auto namedCurve = toNamedCurve(keyData.crv); 93 if (!namedCurve) 94 return nullptr; 95 96 if (keyData.x.isNull() || keyData.y.isNull()) 97 return nullptr; 98 Vector<uint8_t> x; 99 if (!WTF::base64URLDecode(keyData.x, x)) 100 return nullptr; 101 Vector<uint8_t> y; 102 if (!WTF::base64URLDecode(keyData.y, y)) 103 return nullptr; 104 if (keyData.d.isNull()) { 105 // import public key 106 return platformImportJWKPublic(identifier, *namedCurve, WTFMove(x), WTFMove(y), extractable, usages); 107 } 108 109 Vector<uint8_t> d; 110 if (!WTF::base64URLDecode(keyData.d, d)) 111 return nullptr; 112 // import private key 113 return platformImportJWKPrivate(identifier, *namedCurve, WTFMove(x), WTFMove(y), WTFMove(d), extractable, usages); 114 } 115 116 JsonWebKey CryptoKeyEC::exportJwk() const 117 { 118 JsonWebKey result; 119 result.kty = "EC"; 120 switch (m_curve) { 121 case NamedCurve::P256: 122 result.crv = P256; 123 break; 124 case NamedCurve::P384: 125 result.crv = P384; 126 break; 127 } 128 result.key_ops = usages(); 129 result.ext = extractable(); 130 platformAddFieldElements(result); 131 return result; 62 132 } 63 133 -
trunk/Source/WebCore/crypto/keys/CryptoKeyEC.h
r213489 r213560 45 45 namespace WebCore { 46 46 47 struct JsonWebKey; 48 47 49 class EcKeyAlgorithm : public KeyAlgorithm { 48 50 public: … … 75 77 virtual ~CryptoKeyEC(); 76 78 77 static ExceptionOr<CryptoKeyPair> generatePair(CryptoAlgorithmIdentifier, const String&, bool extractable, CryptoKeyUsageBitmap); 79 static ExceptionOr<CryptoKeyPair> generatePair(CryptoAlgorithmIdentifier, const String& curve, bool extractable, CryptoKeyUsageBitmap); 80 static RefPtr<CryptoKeyEC> importRaw(CryptoAlgorithmIdentifier, const String& curve, Vector<uint8_t>&& keyData, bool extractable, CryptoKeyUsageBitmap); 81 static RefPtr<CryptoKeyEC> importJwk(CryptoAlgorithmIdentifier, const String& curve, JsonWebKey&&, bool extractable, CryptoKeyUsageBitmap); 82 83 Vector<uint8_t> exportRaw() const; 84 JsonWebKey exportJwk() const; 85 86 size_t keySizeInBits() const; 78 87 79 88 private: … … 86 95 87 96 static std::optional<CryptoKeyPair> platformGeneratePair(CryptoAlgorithmIdentifier, NamedCurve, bool extractable, CryptoKeyUsageBitmap); 97 static RefPtr<CryptoKeyEC> platformImportRaw(CryptoAlgorithmIdentifier, NamedCurve, Vector<uint8_t>&& keyData, bool extractable, CryptoKeyUsageBitmap); 98 static RefPtr<CryptoKeyEC> platformImportJWKPublic(CryptoAlgorithmIdentifier, NamedCurve, Vector<uint8_t>&& x, Vector<uint8_t>&& y, bool extractable, CryptoKeyUsageBitmap); 99 static RefPtr<CryptoKeyEC> platformImportJWKPrivate(CryptoAlgorithmIdentifier, NamedCurve, Vector<uint8_t>&& x, Vector<uint8_t>&& y, Vector<uint8_t>&& d, bool extractable, CryptoKeyUsageBitmap); 100 void platformAddFieldElements(JsonWebKey&) const; 88 101 89 102 PlatformECKey m_platformKey; -
trunk/Source/WebCore/crypto/keys/CryptoKeyHMAC.cpp
r212465 r213560 107 107 if (usages && !keyData.use.isNull() && keyData.use != "sig") 108 108 return nullptr; 109 if (keyData. usages && ((keyData.usages & usages) != usages))109 if (keyData.key_ops && ((keyData.usages & usages) != usages)) 110 110 return nullptr; 111 111 if (keyData.ext && !keyData.ext.value() && extractable) -
trunk/Source/WebCore/crypto/keys/CryptoKeyRSA.cpp
r212465 r213560 39 39 if (keyData.kty != "RSA") 40 40 return nullptr; 41 if (keyData. usages && ((keyData.usages & usages) != usages))41 if (keyData.key_ops && ((keyData.usages & usages) != usages)) 42 42 return nullptr; 43 43 if (keyData.ext && !keyData.ext.value() && extractable) -
trunk/Source/WebCore/crypto/mac/CryptoKeyECMac.cpp
r213489 r213560 30 30 31 31 #include "CommonCryptoUtilities.h" 32 #include "JsonWebKey.h" 33 #include <wtf/text/Base64.h> 32 34 33 35 namespace WebCore { 36 37 static unsigned char InitialOctet = 0x04; // Per Section 2.3.3 of http://www.secg.org/sec1-v2.pdf 38 39 // Per Section 2.3.4 of http://www.secg.org/sec1-v2.pdf 40 // We only support uncompressed point format. 41 static bool doesUncompressedPointMatchNamedCurve(CryptoKeyEC::NamedCurve curve, size_t size) 42 { 43 switch (curve) { 44 case CryptoKeyEC::NamedCurve::P256: 45 return size == 65; 46 case CryptoKeyEC::NamedCurve::P384: 47 return size == 97; 48 } 49 50 ASSERT_NOT_REACHED(); 51 return false; 52 } 53 54 // Per Section 2.3.5 of http://www.secg.org/sec1-v2.pdf 55 static bool doesFieldElementMatchNamedCurve(CryptoKeyEC::NamedCurve curve, size_t size) 56 { 57 switch (curve) { 58 case CryptoKeyEC::NamedCurve::P256: 59 return size == 32; 60 case CryptoKeyEC::NamedCurve::P384: 61 return size == 48; 62 } 63 64 ASSERT_NOT_REACHED(); 65 return false; 66 } 67 68 static size_t getKeySizeFromNamedCurve(CryptoKeyEC::NamedCurve curve) 69 { 70 switch (curve) { 71 case CryptoKeyEC::NamedCurve::P256: 72 return 256; 73 case CryptoKeyEC::NamedCurve::P384: 74 return 384; 75 } 76 77 ASSERT_NOT_REACHED(); 78 return 0; 79 } 34 80 35 81 CryptoKeyEC::~CryptoKeyEC() … … 38 84 } 39 85 86 size_t CryptoKeyEC::keySizeInBits() const 87 { 88 int result = CCECGetKeySize(m_platformKey); 89 return result ? result : 0; 90 } 91 92 Vector<uint8_t> CryptoKeyEC::exportRaw() const 93 { 94 Vector<uint8_t> result(keySizeInBits() / 4 + 1); // Per Section 2.3.4 of http://www.secg.org/sec1-v2.pdf 95 size_t size = result.size(); 96 CCECCryptorExportKey(kCCImportKeyBinary, result.data(), &size, ccECKeyPublic, m_platformKey); 97 return result; 98 } 99 40 100 std::optional<CryptoKeyPair> CryptoKeyEC::platformGeneratePair(CryptoAlgorithmIdentifier identifier, NamedCurve curve, bool extractable, CryptoKeyUsageBitmap usages) 41 101 { 42 size_t size; 43 switch (curve) { 44 case NamedCurve::P256: 45 size = 256; 46 break; 47 case NamedCurve::P384: 48 size = 384; 49 break; 50 } 51 102 size_t size = getKeySizeFromNamedCurve(curve); 52 103 CCECCryptorRef ccPublicKey; 53 104 CCECCryptorRef ccPrivateKey; 54 CCCryptorStatus status = CCECCryptorGeneratePair(size, &ccPublicKey, &ccPrivateKey); 55 if (status) 105 if (CCECCryptorGeneratePair(size, &ccPublicKey, &ccPrivateKey)) 56 106 return std::nullopt; 57 107 … … 61 111 } 62 112 113 RefPtr<CryptoKeyEC> CryptoKeyEC::platformImportRaw(CryptoAlgorithmIdentifier identifier, NamedCurve curve, Vector<uint8_t>&& keyData, bool extractable, CryptoKeyUsageBitmap usages) 114 { 115 if (!doesUncompressedPointMatchNamedCurve(curve, keyData.size())) 116 return nullptr; 117 118 CCECCryptorRef ccPublicKey; 119 if (CCECCryptorImportKey(kCCImportKeyBinary, keyData.data(), keyData.size(), ccECKeyPublic, &ccPublicKey)) 120 return nullptr; 121 122 return create(identifier, curve, CryptoKeyType::Public, ccPublicKey, extractable, usages); 123 } 124 125 RefPtr<CryptoKeyEC> CryptoKeyEC::platformImportJWKPublic(CryptoAlgorithmIdentifier identifier, NamedCurve curve, Vector<uint8_t>&& x, Vector<uint8_t>&& y, bool extractable, CryptoKeyUsageBitmap usages) 126 { 127 if (!doesFieldElementMatchNamedCurve(curve, x.size()) || !doesFieldElementMatchNamedCurve(curve, y.size())) 128 return nullptr; 129 130 size_t size = getKeySizeFromNamedCurve(curve); 131 CCECCryptorRef ccPublicKey; 132 if (CCECCryptorCreateFromData(size, x.data(), x.size(), y.data(), y.size(), &ccPublicKey)) 133 return nullptr; 134 135 return create(identifier, curve, CryptoKeyType::Public, ccPublicKey, extractable, usages); 136 } 137 138 RefPtr<CryptoKeyEC> CryptoKeyEC::platformImportJWKPrivate(CryptoAlgorithmIdentifier identifier, NamedCurve curve, Vector<uint8_t>&& x, Vector<uint8_t>&& y, Vector<uint8_t>&& d, bool extractable, CryptoKeyUsageBitmap usages) 139 { 140 if (!doesFieldElementMatchNamedCurve(curve, x.size()) || !doesFieldElementMatchNamedCurve(curve, y.size()) || !doesFieldElementMatchNamedCurve(curve, d.size())) 141 return nullptr; 142 143 // A hack to CommonCrypto since it doesn't provide API for creating private keys directly from x, y, d. 144 // BinaryInput = InitialOctet + X + Y + D 145 Vector<uint8_t> binaryInput; 146 binaryInput.append(InitialOctet); 147 binaryInput.appendVector(x); 148 binaryInput.appendVector(y); 149 binaryInput.appendVector(d); 150 151 CCECCryptorRef ccPrivateKey; 152 if (CCECCryptorImportKey(kCCImportKeyBinary, binaryInput.data(), binaryInput.size(), ccECKeyPrivate, &ccPrivateKey)) 153 return nullptr; 154 155 return create(identifier, curve, CryptoKeyType::Private, ccPrivateKey, extractable, usages); 156 } 157 158 void CryptoKeyEC::platformAddFieldElements(JsonWebKey& jwk) const 159 { 160 size_t size = getKeySizeFromNamedCurve(m_curve); 161 size_t sizeInBytes = size / 8; 162 Vector<uint8_t> x(sizeInBytes); 163 size_t xSize = x.size(); 164 Vector<uint8_t> y(sizeInBytes); 165 size_t ySize = y.size(); 166 Vector<uint8_t> d(sizeInBytes); 167 size_t dSize = d.size(); 168 169 CCECCryptorGetKeyComponents(m_platformKey, &size, x.data(), &xSize, y.data(), &ySize, d.data(), &dSize); 170 jwk.x = base64URLEncode(x); 171 jwk.y = base64URLEncode(y); 172 if (type() == Type::Private) 173 jwk.d = base64URLEncode(d); 174 } 175 63 176 } // namespace WebCore 64 177
Note: See TracChangeset
for help on using the changeset viewer.