FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

test: update passphrases to comply with the next OpenSSL FIPS mode · nodejs/node@82b2d9c · GitHub

/ node Public

Commit 82b2d9c

Browse files
authored andcommitted
test: update passphrases to comply with the next OpenSSL FIPS mode
Signed-off-by: Filip Skokan <panva.ip@gmail.com> PR-URL: #65077 Reviewed-By: Richard Lau <richard.lau@ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 89d3905 commit 82b2d9c

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
@@ -109,21 +109,22 @@ const data = Buffer.from('hello store');
109109

110110
{
111111
// Encrypted PKCS#8 with passphrase via { key: url, passphrase }.
112+
const passphrase = 'correct-passphrase';
112113
const { privateKey, publicKey } = generateKeyPairSync('ed25519');
113114
const file = path.join(tmpdir.path, 'enc.pem');
114115
fs.writeFileSync(file, privateKey.export({
115-
format: 'pem', type: 'pkcs8', cipher: 'aes-256-cbc', passphrase: 'pw',
116+
format: 'pem', type: 'pkcs8', cipher: 'aes-256-cbc', passphrase,
116117
}));
117118
const url = pathToFileURL(file);
118119

119-
const sig = sign(null, data, { key: url, passphrase: Buffer.from('pw') });
120+
const sig = sign(null, data, { key: url, passphrase: Buffer.from(passphrase) });
120121
assert.strictEqual(verify(null, data, publicKey, sig), true);
121122

122123
assert.throws(() => createPrivateKey(url), {
123124
code: 'ERR_MISSING_PASSPHRASE',
124125
});
125126

126-
assert.throws(() => createPrivateKey({ key: url, passphrase: 'bad' }),
127+
assert.throws(() => createPrivateKey({ key: url, passphrase: 'wrong-passphrase' }),
127128
common.expectsError({
128129
name: 'Error',
129130
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)

Back | FazBrowse Home | New Git URL