Skip to main content

setPrivateKey

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

Jump to headingprivateKey: ArrayBufferView

Return Type Jump to heading

void
Jump to headingDiffieHellman.prototype.setPrivateKey(
privateKey: string,
encoding: BufferEncoding,
): void

Parameters Jump to heading

Jump to headingprivateKey: string
Jump to headingencoding: BufferEncoding

Return Type Jump to heading

void
Back to top