Skip to main content
Deno 2 is finally here 🎉️
Learn more
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
function generateKeyPair
import { generateKeyPair } from "https://deno.land/std@0.172.0/node/internal/crypto/keygen.ts";

Parameters

type: "rsa"
options: RSAKeyPairOptions<"pem", "pem">
callback: (
err: Error | null,
publicKey: string,
privateKey: string,
) => void

Parameters

type: "rsa"
options: RSAKeyPairOptions<"pem", "der">
callback: (
err: Error | null,
publicKey: string,
privateKey: Buffer,
) => void

Parameters

type: "rsa"
options: RSAKeyPairOptions<"der", "pem">
callback: (
err: Error | null,
publicKey: Buffer,
privateKey: string,
) => void

Parameters

type: "rsa"
options: RSAKeyPairOptions<"der", "der">
callback: (
err: Error | null,
publicKey: Buffer,
privateKey: Buffer,
) => void

Parameters

type: "rsa"
callback: (
err: Error | null,
publicKey: KeyObject,
privateKey: KeyObject,
) => void

Parameters

type: "rsa-pss"
options: RSAPSSKeyPairOptions<"pem", "pem">
callback: (
err: Error | null,
publicKey: string,
privateKey: string,
) => void

Parameters

type: "rsa-pss"
options: RSAPSSKeyPairOptions<"pem", "der">
callback: (
err: Error | null,
publicKey: string,
privateKey: Buffer,
) => void

Parameters

type: "rsa-pss"
options: RSAPSSKeyPairOptions<"der", "pem">
callback: (
err: Error | null,
publicKey: Buffer,
privateKey: string,
) => void

Parameters

type: "rsa-pss"
options: RSAPSSKeyPairOptions<"der", "der">
callback: (
err: Error | null,
publicKey: Buffer,
privateKey: Buffer,
) => void

Parameters

type: "rsa-pss"
callback: (
err: Error | null,
publicKey: KeyObject,
privateKey: KeyObject,
) => void

Parameters

type: "dsa"
options: DSAKeyPairOptions<"pem", "pem">
callback: (
err: Error | null,
publicKey: string,
privateKey: string,
) => void

Parameters

type: "dsa"
options: DSAKeyPairOptions<"pem", "der">
callback: (
err: Error | null,
publicKey: string,
privateKey: Buffer,
) => void

Parameters

type: "dsa"
options: DSAKeyPairOptions<"der", "pem">
callback: (
err: Error | null,
publicKey: Buffer,
privateKey: string,
) => void

Parameters

type: "dsa"
options: DSAKeyPairOptions<"der", "der">
callback: (
err: Error | null,
publicKey: Buffer,
privateKey: Buffer,
) => void

Parameters

type: "dsa"
callback: (
err: Error | null,
publicKey: KeyObject,
privateKey: KeyObject,
) => void

Parameters

type: "ec"
options: ECKeyPairOptions<"pem", "pem">
callback: (
err: Error | null,
publicKey: string,
privateKey: string,
) => void

Parameters

type: "ec"
options: ECKeyPairOptions<"pem", "der">
callback: (
err: Error | null,
publicKey: string,
privateKey: Buffer,
) => void

Parameters

type: "ec"
options: ECKeyPairOptions<"der", "pem">
callback: (
err: Error | null,
publicKey: Buffer,
privateKey: string,
) => void

Parameters

type: "ec"
options: ECKeyPairOptions<"der", "der">
callback: (
err: Error | null,
publicKey: Buffer,
privateKey: Buffer,
) => void

Parameters

type: "ec"
callback: (
err: Error | null,
publicKey: KeyObject,
privateKey: KeyObject,
) => void

Parameters

type: "ed25519"
options: ED25519KeyPairOptions<"pem", "pem">
callback: (
err: Error | null,
publicKey: string,
privateKey: string,
) => void

Parameters

type: "ed25519"
options: ED25519KeyPairOptions<"pem", "der">
callback: (
err: Error | null,
publicKey: string,
privateKey: Buffer,
) => void

Parameters

type: "ed25519"
options: ED25519KeyPairOptions<"der", "pem">
callback: (
err: Error | null,
publicKey: Buffer,
privateKey: string,
) => void

Parameters

type: "ed25519"
options: ED25519KeyPairOptions<"der", "der">
callback: (
err: Error | null,
publicKey: Buffer,
privateKey: Buffer,
) => void

Parameters

type: "ed25519"
options: ED25519KeyPairKeyObjectOptions | undefined
callback: (
err: Error | null,
publicKey: KeyObject,
privateKey: KeyObject,
) => void

Parameters

type: "ed448"
options: ED448KeyPairOptions<"pem", "pem">
callback: (
err: Error | null,
publicKey: string,
privateKey: string,
) => void

Parameters

type: "ed448"
options: ED448KeyPairOptions<"pem", "der">
callback: (
err: Error | null,
publicKey: string,
privateKey: Buffer,
) => void

Parameters

type: "ed448"
options: ED448KeyPairOptions<"der", "pem">
callback: (
err: Error | null,
publicKey: Buffer,
privateKey: string,
) => void

Parameters

type: "ed448"
options: ED448KeyPairOptions<"der", "der">
callback: (
err: Error | null,
publicKey: Buffer,
privateKey: Buffer,
) => void

Parameters

type: "ed448"
options: ED448KeyPairKeyObjectOptions | undefined
callback: (
err: Error | null,
publicKey: KeyObject,
privateKey: KeyObject,
) => void

Parameters

type: "x25519"
options: X25519KeyPairOptions<"pem", "pem">
callback: (
err: Error | null,
publicKey: string,
privateKey: string,
) => void

Parameters

type: "x25519"
options: X25519KeyPairOptions<"pem", "der">
callback: (
err: Error | null,
publicKey: string,
privateKey: Buffer,
) => void

Parameters

type: "x25519"
options: X25519KeyPairOptions<"der", "pem">
callback: (
err: Error | null,
publicKey: Buffer,
privateKey: string,
) => void

Parameters

type: "x25519"
options: X25519KeyPairOptions<"der", "der">
callback: (
err: Error | null,
publicKey: Buffer,
privateKey: Buffer,
) => void

Parameters

type: "x25519"
options: X25519KeyPairKeyObjectOptions | undefined
callback: (
err: Error | null,
publicKey: KeyObject,
privateKey: KeyObject,
) => void

Parameters

type: "x448"
options: X448KeyPairOptions<"pem", "pem">
callback: (
err: Error | null,
publicKey: string,
privateKey: string,
) => void

Parameters

type: "x448"
options: X448KeyPairOptions<"pem", "der">
callback: (
err: Error | null,
publicKey: string,
privateKey: Buffer,
) => void

Parameters

type: "x448"
options: X448KeyPairOptions<"der", "pem">
callback: (
err: Error | null,
publicKey: Buffer,
privateKey: string,
) => void

Parameters

type: "x448"
options: X448KeyPairOptions<"der", "der">
callback: (
err: Error | null,
publicKey: Buffer,
privateKey: Buffer,
) => void

Parameters

type: "x448"
options: X448KeyPairKeyObjectOptions | undefined
callback: (
err: Error | null,
publicKey: KeyObject,
privateKey: KeyObject,
) => void