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

Usage in Deno

import { DiffieHellman } from "node:crypto";
DiffieHellman.prototype.generateKeys(): Buffer

Generates private and public Diffie-Hellman key values unless they have been generated or computed already, and returns the public key in the specified encoding. This key should be transferred to the other party. If encoding is provided a string is returned; otherwise a Buffer is returned.

This function is a thin wrapper around DH_generate_key(). In particular, once a private key has been generated or set, calling this function only updates the public key but does not generate a new private key.

Return Type

Buffer
DiffieHellman.prototype.generateKeys(encoding: BinaryToTextEncoding): string

Parameters

Return Type

string
Back to top