Skip to main content
privateDecrypt - node__crypto.d.ts - Node documentation
function privateDecrypt

Usage in Deno

```typescript import { privateDecrypt } from "node:node__crypto.d.ts"; ```
privateDecrypt(
privateKey: RsaPrivateKey | KeyLike,
buffer: ArrayBufferView,
): Buffer
Decrypts `buffer` with `privateKey`. `buffer` was previously encrypted using the corresponding public key, for example using [publicEncrypt](../.././node__crypto.d.ts/~/publicEncrypt). If `privateKey` is not a `KeyObject`, this function behaves as if `privateKey` had been passed to [createPrivateKey](../.././node__crypto.d.ts/~/createPrivateKey). If it is an object, the `padding` property can be passed. Otherwise, this function uses `RSA_PKCS1_OAEP_PADDING`.

Parameters

privateKey: RsaPrivateKey | KeyLike
buffer: ArrayBufferView

Return Type

Buffer