crypto.publicDecrypt(key, buffer)
key{Object | string | Buffer | KeyObject}passphrase{string | Buffer} An optional passphrase for the private key.padding{crypto.constants} An optional padding value defined incrypto.constants, which may be:crypto.constants.RSA_NO_PADDINGorcrypto.constants.RSA_PKCS1_PADDING.
buffer{Buffer | TypedArray | DataView}- Returns: {Buffer} A new
Bufferwith the decrypted content.
Decrypts buffer with key.buffer was previously encrypted using
the corresponding private key, for example using [crypto.privateEncrypt()][].
If key is not a [KeyObject][], this function behaves as if
key had been passed to [crypto.createPublicKey()][]. If it is an
object, the padding property can be passed. Otherwise, this function uses
RSA_PKCS1_PADDING.
Because RSA public keys can be derived from private keys, a private key may be passed instead of a public key.
Feedback
Was this page helpful?
很高兴听到! 请告诉我们,我们如何才能改善.
很遗憾听到这个消息。 请告诉我们,我们如何才能改善.
最后修改 April 16, 2020: 加密 (a75e592)