Browse Source

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.
Andrew Kaster 1 year ago
parent
commit
c4be9318a2

+ 2 - 2
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

+ 20 - 18
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}`);
         }