From 96aa8feee64cb67d343d6dce6c8d04e4f106bb00 Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Thu, 6 Aug 2026 12:40:17 +0200 Subject: [PATCH] test: update passphrases to comply with the next OpenSSL FIPS mode Signed-off-by: Filip Skokan --- test/parallel/test-crypto-key-store.js | 7 ++++--- test/parallel/test-crypto-no-algorithm.js | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-crypto-key-store.js b/test/parallel/test-crypto-key-store.js index fdc82cc9d579..58a23192b28f 100644 --- a/test/parallel/test-crypto-key-store.js +++ b/test/parallel/test-crypto-key-store.js @@ -115,21 +115,22 @@ const data = Buffer.from('hello store'); { // Encrypted PKCS#8 with passphrase via { key: url, passphrase }. + const passphrase = 'correct-passphrase'; const { privateKey, publicKey } = generateKeyPairSync('ed25519'); const file = path.join(tmpdir.path, 'enc.pem'); fs.writeFileSync(file, privateKey.export({ - format: 'pem', type: 'pkcs8', cipher: 'aes-256-cbc', passphrase: 'pw', + format: 'pem', type: 'pkcs8', cipher: 'aes-256-cbc', passphrase, })); const url = pathToFileURL(file); - const sig = sign(null, data, { key: url, passphrase: Buffer.from('pw') }); + const sig = sign(null, data, { key: url, passphrase: Buffer.from(passphrase) }); assert.strictEqual(verify(null, data, publicKey, sig), true); assert.throws(() => createPrivateKey(url), { code: 'ERR_MISSING_PASSPHRASE', }); - assert.throws(() => createPrivateKey({ key: url, passphrase: 'bad' }), + assert.throws(() => createPrivateKey({ key: url, passphrase: 'wrong-passphrase' }), common.expectsError({ name: 'Error', code: /^ERR_OSSL_/, diff --git a/test/parallel/test-crypto-no-algorithm.js b/test/parallel/test-crypto-no-algorithm.js index 3a9473dfb165..90d19ff97fcb 100644 --- a/test/parallel/test-crypto-no-algorithm.js +++ b/test/parallel/test-crypto-no-algorithm.js @@ -30,7 +30,7 @@ if (isMainThread) { const derivations = [ ['HKDF', () => crypto.hkdfSync('sha256', Buffer.alloc(32), Buffer.alloc(8), Buffer.alloc(0), 32)], - ['PBKDF2', () => crypto.pbkdf2Sync('secret', Buffer.alloc(16), 1000, 32, + ['PBKDF2', () => crypto.pbkdf2Sync('passphrase', Buffer.alloc(16), 1000, 32, 'sha256')], ]; for (const { 0: name, 1: derive } of derivations) {