Skip to main content
DiffieHellman.prototype.setPrivateKey - crypto - Node documentation
method DiffieHellman.prototype.setPrivateKey

Usage in Deno

import { DiffieHellman } from "node:crypto";
DiffieHellman.prototype.setPrivateKey(privateKey: ArrayBufferView): void

Sets the Diffie-Hellman private key. If the encoding argument is provided,privateKey is expected to be a string. If no encoding is provided, privateKey is expected to be a Buffer, TypedArray, or DataView.

This function does not automatically compute the associated public key. Either diffieHellman.setPublicKey() or diffieHellman.generateKeys() can be used to manually provide the public key or to automatically derive it.

Parameters

privateKey: ArrayBufferView

Return Type

void
DiffieHellman.prototype.setPrivateKey(
privateKey: string,
encoding: BufferEncoding,
): void

Parameters

privateKey: string
encoding: BufferEncoding

Return Type

void