Skip to content

Commit ce275f1

Browse files
authored
test: update passphrases to comply with the next OpenSSL FIPS mode
Signed-off-by: Filip Skokan <[email protected]> PR-URL: #65077 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent b65015a commit ce275f1

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

‎test/parallel/test-crypto-key-store.js‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,21 +115,22 @@ const data = Buffer.from('hello store');
115115

116116
{
117117
// Encrypted PKCS#8 with passphrase via { key: url, passphrase }.
118+
const passphrase = 'correct-passphrase';
118119
const { privateKey, publicKey } = generateKeyPairSync('ed25519');
119120
const file = path.join(tmpdir.path, 'enc.pem');
120121
fs.writeFileSync(file, privateKey.export({
121-
format: 'pem', type: 'pkcs8', cipher: 'aes-256-cbc', passphrase: 'pw',
122+
format: 'pem', type: 'pkcs8', cipher: 'aes-256-cbc', passphrase,
122123
}));
123124
const url = pathToFileURL(file);
124125

125-
const sig = sign(null, data, { key: url, passphrase: Buffer.from('pw') });
126+
const sig = sign(null, data, { key: url, passphrase: Buffer.from(passphrase) });
126127
assert.strictEqual(verify(null, data, publicKey, sig), true);
127128

128129
assert.throws(() => createPrivateKey(url), {
129130
code: 'ERR_MISSING_PASSPHRASE',
130131
});
131132

132-
assert.throws(() => createPrivateKey({ key: url, passphrase: 'bad' }),
133+
assert.throws(() => createPrivateKey({ key: url, passphrase: 'wrong-passphrase' }),
133134
common.expectsError({
134135
name: 'Error',
135136
code: /^ERR_OSSL_/,

‎test/parallel/test-crypto-no-algorithm.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ if (isMainThread) {
3030
const derivations = [
3131
['HKDF', () => crypto.hkdfSync('sha256', Buffer.alloc(32), Buffer.alloc(8),
3232
Buffer.alloc(0), 32)],
33-
['PBKDF2', () => crypto.pbkdf2Sync('secret', Buffer.alloc(16), 1000, 32,
33+
['PBKDF2', () => crypto.pbkdf2Sync('passphrase', Buffer.alloc(16), 1000, 32,
3434
'sha256')],
3535
];
3636
for (const { 0: name, 1: derive } of derivations) {

0 commit comments

Comments
 (0)