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

Usage in Deno

```typescript import { createPrivateKey } from "node:node__crypto.d.ts"; ```
createPrivateKey(key:
PrivateKeyInput
| string
| Buffer
| JsonWebKeyInput
): KeyObject
Creates and returns a new key object containing a private key. If `key` is a string or `Buffer`, `format` is assumed to be `'pem'`; otherwise, `key` must be an object with the properties described above. If the private key is encrypted, a `passphrase` must be specified. The length of the passphrase is limited to 1024 bytes.

Parameters

key:
PrivateKeyInput
| string
| Buffer
| JsonWebKeyInput

Return Type