Skip to main content

generateKeys

method DiffieHellman.prototype.generateKeys
Jump to headingDiffieHellman.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 Jump to heading

Buffer
Jump to headingDiffieHellman.prototype.generateKeys(encoding: BinaryToTextEncoding): string
Back to top