Skip to main content
Certificate.exportPublicKey - Node documentation
method Certificate.exportPublicKey

Usage in Deno

import { Certificate } from "node:crypto";
Certificate.exportPublicKey(
spkac: BinaryLike,
encoding?: string,
): Buffer
const { Certificate } = await import('node:crypto');
const spkac = getSpkacSomehow();
const publicKey = Certificate.exportPublicKey(spkac);
console.log(publicKey);
// Prints: the public key as <Buffer ...>

Parameters

spkac: BinaryLike
optional
encoding: string

The encoding of the spkac string.

Return Type

Buffer

The public key component of the spkac data structure, which includes a public key and a challenge.