diff --git a/test/fixtures/wpt/README.md b/test/fixtures/wpt/README.md index 33af47703674bb..a4ca98dc7ffa4f 100644 --- a/test/fixtures/wpt/README.md +++ b/test/fixtures/wpt/README.md @@ -32,7 +32,7 @@ Last update: - user-timing: https://github.com/web-platform-tests/wpt/tree/5ae85bf826/user-timing - wasm/jsapi: https://github.com/web-platform-tests/wpt/tree/cde25e7e3c/wasm/jsapi - wasm/webapi: https://github.com/web-platform-tests/wpt/tree/fd1b23eeaa/wasm/webapi -- WebCryptoAPI: https://github.com/web-platform-tests/wpt/tree/d4e14d714c/WebCryptoAPI +- WebCryptoAPI: https://github.com/web-platform-tests/wpt/tree/5e042cbc4e/WebCryptoAPI - webidl/ecmascript-binding/es-exceptions: https://github.com/web-platform-tests/wpt/tree/a370aad338/webidl/ecmascript-binding/es-exceptions - webmessaging/broadcastchannel: https://github.com/web-platform-tests/wpt/tree/e97fac4791/webmessaging/broadcastchannel diff --git a/test/fixtures/wpt/WebCryptoAPI/derive_bits_keys/cfrg_curves_bits.js b/test/fixtures/wpt/WebCryptoAPI/derive_bits_keys/cfrg_curves_bits.js index 4e12ca0eb711fa..ef6905e574c158 100644 --- a/test/fixtures/wpt/WebCryptoAPI/derive_bits_keys/cfrg_curves_bits.js +++ b/test/fixtures/wpt/WebCryptoAPI/derive_bits_keys/cfrg_curves_bits.js @@ -60,6 +60,15 @@ function define_tests() { }, algorithmName + " mixed case parameters"); // Null length + // "Null" is not valid per the current spec + // - https://github.com/w3c/webcrypto/issues/322 + // - https://github.com/w3c/webcrypto/issues/329 + // + // Proposal for a spec change: + // - https://github.com/w3c/webcrypto/pull/345 + // + // This test case may be replaced by these new tests: + // - https://github.com/web-platform-tests/wpt/pull/43400 promise_test(function(test) { return subtle.deriveBits({name: algorithmName, public: publicKeys[algorithmName]}, privateKeys[algorithmName], null) .then(function(derivation) { diff --git a/test/fixtures/wpt/WebCryptoAPI/derive_bits_keys/ecdh_bits.js b/test/fixtures/wpt/WebCryptoAPI/derive_bits_keys/ecdh_bits.js index e52ffc6bfdb6f6..cb9747a529fd53 100644 --- a/test/fixtures/wpt/WebCryptoAPI/derive_bits_keys/ecdh_bits.js +++ b/test/fixtures/wpt/WebCryptoAPI/derive_bits_keys/ecdh_bits.js @@ -56,6 +56,15 @@ function define_tests() { }, namedCurve + " mixed case parameters"); // Null length + // "Null" is not valid per the current spec + // - https://github.com/w3c/webcrypto/issues/322 + // - https://github.com/w3c/webcrypto/issues/329 + // + // Proposal for a spec change: + // - https://github.com/w3c/webcrypto/pull/345 + // + // This test case may be replaced by these new tests: + // - https://github.com/web-platform-tests/wpt/pull/43400 promise_test(function(test) { return subtle.deriveBits({name: "ECDH", public: publicKeys[namedCurve]}, privateKeys[namedCurve], null) .then(function(derivation) { diff --git a/test/fixtures/wpt/WebCryptoAPI/derive_bits_keys/hkdf.js b/test/fixtures/wpt/WebCryptoAPI/derive_bits_keys/hkdf.js index 2bb58533473eb9..3903da5cddff94 100644 --- a/test/fixtures/wpt/WebCryptoAPI/derive_bits_keys/hkdf.js +++ b/test/fixtures/wpt/WebCryptoAPI/derive_bits_keys/hkdf.js @@ -140,6 +140,15 @@ function define_tests() { }, testName + " with missing info"); // length null (OperationError) + // "Null" is not valid per the current spec + // - https://github.com/w3c/webcrypto/issues/322 + // - https://github.com/w3c/webcrypto/issues/329 + // + // Proposal for a spec change: + // - https://github.com/w3c/webcrypto/pull/345 + // + // This test case may be replaced by these new tests: + // - https://github.com/web-platform-tests/wpt/pull/43400 subsetTest(promise_test, function(test) { return subtle.deriveBits(algorithm, baseKeys[derivedKeySize], null) .then(function(derivation) { diff --git a/test/fixtures/wpt/WebCryptoAPI/derive_bits_keys/pbkdf2.js b/test/fixtures/wpt/WebCryptoAPI/derive_bits_keys/pbkdf2.js index 0403f382e1479c..4e4ae79d800a40 100644 --- a/test/fixtures/wpt/WebCryptoAPI/derive_bits_keys/pbkdf2.js +++ b/test/fixtures/wpt/WebCryptoAPI/derive_bits_keys/pbkdf2.js @@ -105,6 +105,15 @@ function define_tests() { // Test various error conditions for deriveBits below: // length null (OperationError) + // "Null" is not valid per the current spec + // - https://github.com/w3c/webcrypto/issues/322 + // - https://github.com/w3c/webcrypto/issues/329 + // + // Proposal for a spec change: + // - https://github.com/w3c/webcrypto/pull/345 + // + // This test case may be replaced by these new tests: + // - https://github.com/web-platform-tests/wpt/pull/43400 subsetTest(promise_test, function(test) { return subtle.deriveBits({name: "PBKDF2", salt: salts[saltSize], hash: hashName, iterations: parseInt(iterations)}, baseKeys[passwordSize], null) .then(function(derivation) { diff --git a/test/fixtures/wpt/WebCryptoAPI/import_export/ec_importKey.https.any.js b/test/fixtures/wpt/WebCryptoAPI/import_export/ec_importKey.https.any.js index 31f062e313f6fe..a01bfbb0ef2e18 100644 --- a/test/fixtures/wpt/WebCryptoAPI/import_export/ec_importKey.https.any.js +++ b/test/fixtures/wpt/WebCryptoAPI/import_export/ec_importKey.https.any.js @@ -80,6 +80,9 @@ } testFormat(format, algorithm, data, curve, usages, extractable); + if (vector.name === 'ECDH' && format === 'jwk') { + testEcdhJwkAlg(algorithm, { ...data.jwk, alg: 'any alg works here' }, curve, usages, extractable); + } }); }); @@ -90,11 +93,13 @@ var data = keyData[curve]; allValidUsages(vector.privateUsages).forEach(function(usages) { testFormat(format, algorithm, data, curve, usages, extractable); + if (vector.name === 'ECDH' && format === 'jwk') { + testEcdhJwkAlg(algorithm, { ...data.jwk, alg: 'any alg works here' }, curve, usages, extractable); + } }); testEmptyUsages(format, algorithm, data, curve, extractable); }); }); - }); }); @@ -151,6 +156,21 @@ }, "Empty Usages: " + keySize.toString() + " bits " + parameterString(format, false, keyData, algorithm, extractable, usages)); } + // Test ECDH importKey with a JWK format + // Should succeed with any "alg" value + function testEcdhJwkAlg(algorithm, keyData, keySize, usages, extractable) { + const format = "jwk"; + promise_test(function(test) { + return subtle.importKey(format, keyData, algorithm, extractable, usages). + then(function(key) { + assert_equals(key.constructor, CryptoKey, "Imported a CryptoKey object"); + assert_goodCryptoKey(key, algorithm, extractable, usages, keyData.d ? 'private' : 'public'); + }, function(err) { + assert_unreached("Threw an unexpected error: " + err.toString()); + }); + }, "ECDH any JWK alg: " + keySize.toString() + " bits " + parameterString(format, false, keyData, algorithm, extractable, usages)); + } + // Helper methods follow: diff --git a/test/fixtures/wpt/versions.json b/test/fixtures/wpt/versions.json index 0e04684b381f2f..a7c655125b5c22 100644 --- a/test/fixtures/wpt/versions.json +++ b/test/fixtures/wpt/versions.json @@ -88,7 +88,7 @@ "path": "wasm/webapi" }, "WebCryptoAPI": { - "commit": "d4e14d714c5242e174ba9aec43caf5eb514d0f09", + "commit": "5e042cbc4ecab7b2279a5fd411c6daa24ca886c6", "path": "WebCryptoAPI" }, "webidl/ecmascript-binding/es-exceptions": {