mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-24 19:37:15 +00:00
Bug 1918590 [wpt PR 48144] - [WebCryptoAPI] test generateKey > exportKey roundtrip, a=testonly
Automatic update from web-platform-tests [WebCryptoAPI] Test generateKey -> exportKey roundtrip (#48144) -- wpt-commits: 272064ebf9a3d313a2d4db8bb9ce2790648aa162 wpt-pr: 48144
This commit is contained in:
parent
41cab875a2
commit
dbb7e0c3c7
@ -5,7 +5,8 @@ function run_test(algorithmNames, slowTest) {
|
||||
setup({explicit_timeout: true});
|
||||
|
||||
// These tests check that generateKey successfully creates keys
|
||||
// when provided any of a wide set of correct parameters.
|
||||
// when provided any of a wide set of correct parameters
|
||||
// and that they can be exported afterwards.
|
||||
//
|
||||
// There are a lot of combinations of possible parameters,
|
||||
// resulting in a very large number of tests
|
||||
@ -68,9 +69,32 @@ function run_test(algorithmNames, slowTest) {
|
||||
} else {
|
||||
assert_goodCryptoKey(result, algorithm, extractable, usages, "secret");
|
||||
}
|
||||
return result;
|
||||
}, function(err) {
|
||||
assert_unreached("Threw an unexpected error: " + err.toString());
|
||||
});
|
||||
assert_unreached("generateKey threw an unexpected error: " + err.toString());
|
||||
})
|
||||
.then(async function (result) {
|
||||
if (resultType === "CryptoKeyPair") {
|
||||
await Promise.all([
|
||||
subtle.exportKey('jwk', result.publicKey),
|
||||
subtle.exportKey('spki', result.publicKey),
|
||||
result.publicKey.algorithm.name.startsWith('RSA') ? undefined : subtle.exportKey('raw', result.publicKey),
|
||||
...(extractable ? [
|
||||
subtle.exportKey('jwk', result.privateKey),
|
||||
subtle.exportKey('pkcs8', result.privateKey),
|
||||
] : [])
|
||||
]);
|
||||
} else {
|
||||
if (extractable) {
|
||||
await Promise.all([
|
||||
subtle.exportKey('raw', result),
|
||||
subtle.exportKey('jwk', result),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}, function(err) {
|
||||
assert_unreached("exportKey threw an unexpected error: " + err.toString());
|
||||
})
|
||||
}, testTag + ": generateKey" + parameterString(algorithm, extractable, usages));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user