Closed dice36D closed 1 day ago
@nodejs/crypto
But to crypto.privateDecrypt and crypto.publicDecrypt, the key objects are not contain "key" (show as in capture).
According to the documentation, they can contain key
.
If
privateKey
is not aKeyObject
, this function behaves as ifprivateKey
had been passed tocrypto.createPrivateKey()
. If it is an object, the padding property can be passed. Otherwise, this function usesRSA_PKCS1_OAEP_PADDING
.
As shown below, crypto.createPrivateKey()
accepts a key
object property:
@RedYetiDev summarized it correctly.
Affected URL(s)
https://nodejs.org/docs/latest-v14.x/api/crypto.html#crypto_crypto_publicdecrypt_key_buffer, https://nodejs.org/docs/latest-v14.x/api/crypto.html#crypto_crypto_privatedecrypt_privatekey_buffer, https://nodejs.org/docs/latest-v18.x/api/crypto.html#cryptoprivatedecryptprivatekey-buffer
Description of the problem
I only read version 14 and version 18 document, and I found that
With APIs: crypto.privateEncrypt and crypto.publicEncrypt, the privateKey object is described with following keys: "key", "passphrase", "padding" the public key object is describe with following keys: "key", "oaepHash", "oaepLabel", "passphrase", "padding"
But to crypto.privateDecrypt and crypto.publicDecrypt, the key objects are not contain "key" (show as in capture). Can we set "key" in a JS object or not?