diff --git a/lib/internal/crypto/util.js b/lib/internal/crypto/util.js index 40a677606bf3f0..1e042d0c74406d 100644 --- a/lib/internal/crypto/util.js +++ b/lib/internal/crypto/util.js @@ -278,7 +278,11 @@ const validateByteSource = hideStackFrames((val, name) => { }); function onDone(resolve, reject, err, result) { - if (err) return reject(err); + if (err) { + return reject(lazyDOMException( + 'The operation failed for an operation-specific reason', + 'OperationError')); + } resolve(result); } diff --git a/test/parallel/test-webcrypto-encrypt-decrypt-aes.js b/test/parallel/test-webcrypto-encrypt-decrypt-aes.js index 885cded906b079..5dfae1c5d55385 100644 --- a/test/parallel/test-webcrypto-encrypt-decrypt-aes.js +++ b/test/parallel/test-webcrypto-encrypt-decrypt-aes.js @@ -119,7 +119,7 @@ async function testDecrypt({ keyBuffer, algorithm, result }) { decryptionFailing.forEach((vector) => { variations.push(assert.rejects(testDecrypt(vector), { - message: /bad decrypt/ + name: 'OperationError' })); }); @@ -158,7 +158,7 @@ async function testDecrypt({ keyBuffer, algorithm, result }) { decryptionFailing.forEach((vector) => { variations.push(assert.rejects(testDecrypt(vector), { - message: /bad decrypt/ + name: 'OperationError' })); }); @@ -195,7 +195,7 @@ async function testDecrypt({ keyBuffer, algorithm, result }) { decryptionFailing.forEach((vector) => { variations.push(assert.rejects(testDecrypt(vector), { - message: /bad decrypt/ + name: 'OperationError' })); }); diff --git a/test/parallel/test-webcrypto-encrypt-decrypt-rsa.js b/test/parallel/test-webcrypto-encrypt-decrypt-rsa.js index 151eebd36c9765..6af0fa727969d8 100644 --- a/test/parallel/test-webcrypto-encrypt-decrypt-rsa.js +++ b/test/parallel/test-webcrypto-encrypt-decrypt-rsa.js @@ -127,7 +127,7 @@ async function testEncryptionLongPlaintext({ algorithm, return assert.rejects( subtle.encrypt(algorithm, publicKey, newplaintext), { - message: /data too large/ + name: 'OperationError' }); } diff --git a/test/wpt/status/WebCryptoAPI.json b/test/wpt/status/WebCryptoAPI.json index 14e1cd0e3e222a..e6be5b5880ae29 100644 --- a/test/wpt/status/WebCryptoAPI.json +++ b/test/wpt/status/WebCryptoAPI.json @@ -2654,33 +2654,12 @@ "encrypt_decrypt/aes_cbc.https.any.js": { "fail": { "expected": [ - "AES-CBC 128-bit key, zeroPadChar", - "AES-CBC 128-bit key, bigPadChar", - "AES-CBC 128-bit key, inconsistentPadChars", - "AES-CBC 192-bit key, zeroPadChar", - "AES-CBC 192-bit key, bigPadChar", - "AES-CBC 192-bit key, inconsistentPadChars", - "AES-CBC 256-bit key, zeroPadChar", - "AES-CBC 256-bit key, bigPadChar", - "AES-CBC 256-bit key, inconsistentPadChars" ] } }, "encrypt_decrypt/rsa_oaep.https.any.js": { "fail": { "expected": [ - "RSA-OAEP with SHA-1 and no label too long plaintext", - "RSA-OAEP with SHA-256 and no label too long plaintext", - "RSA-OAEP with SHA-384 and no label too long plaintext", - "RSA-OAEP with SHA-512 and no label too long plaintext", - "RSA-OAEP with SHA-1 and empty label too long plaintext", - "RSA-OAEP with SHA-256 and empty label too long plaintext", - "RSA-OAEP with SHA-384 and empty label too long plaintext", - "RSA-OAEP with SHA-512 and empty label too long plaintext", - "RSA-OAEP with SHA-1 and a label too long plaintext", - "RSA-OAEP with SHA-256 and a label too long plaintext", - "RSA-OAEP with SHA-384 and a label too long plaintext", - "RSA-OAEP with SHA-512 and a label too long plaintext" ] } },