crypto.privateDecrypt(privateKey, buffer)


使用 privateKey 解密 bufferbuffer 之前是使用对应的公钥加密的,例如使用 crypto.publicEncrypt()

【Decrypts buffer with privateKey. buffer was previously encrypted using the corresponding public key, for example using crypto.publicEncrypt().】

如果 privateKey 不是 KeyObject,该函数的行为就好像将 privateKey 传递给了 crypto.createPrivateKey()。如果它是一个对象,可以传递 padding 属性。否则,该函数将使用 RSA_PKCS1_OAEP_PADDING

【If privateKey is not a KeyObject, this function behaves as if privateKey had been passed to crypto.createPrivateKey(). If it is an object, the padding property can be passed. Otherwise, this function uses RSA_PKCS1_OAEP_PADDING.】