From c4be9318a2f0044b738405d6a8449edf06cd367b Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Thu, 14 Mar 2024 14:39:23 -0600 Subject: [PATCH] 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. --- .../Crypto/SubtleCrypto-generateKey.txt | 4 +- .../Crypto/SubtleCrypto-generateKey.html | 38 ++++++++++--------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/Tests/LibWeb/Text/expected/Crypto/SubtleCrypto-generateKey.txt b/Tests/LibWeb/Text/expected/Crypto/SubtleCrypto-generateKey.txt index cb5edb3da4..2b4f3e43e4 100644 --- a/Tests/LibWeb/Text/expected/Crypto/SubtleCrypto-generateKey.txt +++ b/Tests/LibWeb/Text/expected/Crypto/SubtleCrypto-generateKey.txt @@ -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 diff --git a/Tests/LibWeb/Text/input/Crypto/SubtleCrypto-generateKey.html b/Tests/LibWeb/Text/input/Crypto/SubtleCrypto-generateKey.html index 5c8847d9bb..1701b8a78f 100644 --- a/Tests/LibWeb/Text/input/Crypto/SubtleCrypto-generateKey.html +++ b/Tests/LibWeb/Text/input/Crypto/SubtleCrypto-generateKey.html @@ -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}`); }