Skip to content

Commit 7ebfca9

Browse files
committed
fixup! crypto: support loading private keys through STORE loaders
1 parent 5202c20 commit 7ebfca9

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,16 @@ const data = Buffer.from('hello store');
188188
});
189189

190190
// OpenSSL has no reason string for system library errors, so error.code
191-
// cannot be derived for these; the message still identifies the failure.
191+
// cannot be derived for these. Which entry becomes the message is not
192+
// portable either: some builds leave a generic STORE `unsupported` on top of
193+
// the error the loader itself raised. The reason is reported either way.
192194
assert.throws(
193195
() => createPrivateKey(pathToFileURL(path.join(tmpdir.path, 'missing.pem'))),
194-
{ message: /No such file or directory/ });
196+
(err) => {
197+
assert.match([err.message, ...err.opensslErrorStack ?? []].join('\n'),
198+
/No such file or directory/);
199+
return true;
200+
});
195201
}
196202

197203
{

0 commit comments

Comments
 (0)