crypto: clarify missing cipher error

Explain that a cipher is required when a passphrase is provided.

Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/64852
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
This commit is contained in:
Filip Skokan authored and Node.js GitHub Bot committed 2026-08-01 20:34:41 +00:00
1 parent 9c0255bf15
commit 276fe2be45
2 files changed
+5 -2

No files matched your search

+3 -1
View File
@@ -470,7 +470,9 @@ function parseKeyEncoding(enc, keyType, isPublic, objName) {
encodingNames[type], 'does not support encryption');
}
} else if (passphrase !== undefined) {
throw new ERR_INVALID_ARG_VALUE(option('cipher', objName), cipher);
throw new ERR_INVALID_ARG_VALUE(
option('cipher', objName), cipher,
'is required when a passphrase is specified');
}
}
+2 -1
View File
@@ -1014,7 +1014,8 @@ if (!process.features.openssl_is_boringssl) {
}, {
name: 'TypeError',
code: 'ERR_INVALID_ARG_VALUE',
message: "The property 'options.cipher' is invalid. Received undefined"
message: "The property 'options.cipher' is required when a " +
'passphrase is specified. Received undefined',
});
}