diff --git a/test/parallel/test-crypto-key-store.js b/test/parallel/test-crypto-key-store.js index fdc82cc9d57..58a23192b28 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 3a9473dfb16..90d19ff97fc 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) {