Tests: Only use a 256-bit RSA key in SubtleCrypto generateKey test

Until we get a better performing RSA keygen algorithm, this test times
out occasionally in CI with a 512-bit key.
This commit is contained in:
Andrew Kaster 2024-03-14 14:39:23 -06:00 committed by Andrew Kaster
parent 1521a60a67
commit c4be9318a2
Notes: sideshowbarker 2024-07-17 10:08:28 +09:00
2 changed files with 22 additions and 20 deletions

View File

@ -1,11 +1,11 @@
generateKey with RSA-OAEP algorithm
publicKey: [object CryptoKey]
publicKey algorithm: {"name":"RSA-OAEP","modulusLength":512,"publicExponent":{"0":1,"1":0,"2":1},"hash":"SHA-256"}
publicKey algorithm: {"name":"RSA-OAEP","modulusLength":256,"publicExponent":{"0":1,"1":0,"2":1},"hash":"SHA-256"}
publicKey type: public
publicKey extractable: true
publicKey usages: encrypt,wrapKey
privateKey: [object CryptoKey]
privateKey algorithm: {"name":"RSA-OAEP","modulusLength":512,"publicExponent":{"0":1,"1":0,"2":1},"hash":"SHA-256"}
privateKey algorithm: {"name":"RSA-OAEP","modulusLength":256,"publicExponent":{"0":1,"1":0,"2":1},"hash":"SHA-256"}
privateKey type: private
privateKey extractable: true
privateKey usages: decrypt,unwrapKey

View File

@ -5,11 +5,11 @@
}
asyncTest(async done => {
// FIXME: Generate a key with module lengths longer than 512, when they don't take an eternity to generate.
// FIXME: Generate a key with module lengths longer than 256, when they don't take an eternity to generate.
// This is #23561
let algorithm = {
name: "RSA-OAEP",
modulusLength: 512,
modulusLength: 256,
publicExponent: new Uint8Array([1, 0, 1]),
hash: "SHA-256",
};
@ -17,11 +17,12 @@
println("generateKey with RSA-OAEP algorithm");
var key = undefined;
try {
key = await window.crypto.subtle.generateKey(
algorithm,
true,
["encrypt", "decrypt", "wrapKey", "unwrapKey"]
);
key = await window.crypto.subtle.generateKey(algorithm, true, [
"encrypt",
"decrypt",
"wrapKey",
"unwrapKey",
]);
} catch (e) {
println(`FAIL: ${e}`);
}
@ -41,22 +42,23 @@
println("invalid usages throw");
try {
const key2 = await window.crypto.subtle.generateKey(
algorithm,
true,
["encrypt", "decrypt", "wrapKey", "unwrapKey", "sign"]
);
const key2 = await window.crypto.subtle.generateKey(algorithm, true, [
"encrypt",
"decrypt",
"wrapKey",
"unwrapKey",
"sign",
]);
} catch (e) {
println(`Error: ${e}`);
}
println("no usages for private key throws");
try {
const key3 = await window.crypto.subtle.generateKey(
algorithm,
true,
["encrypt", "wrapKey"]
);
const key3 = await window.crypto.subtle.generateKey(algorithm, true, [
"encrypt",
"wrapKey",
]);
} catch (e) {
println(`Error: ${e}`);
}