Private
constructorA bit field containing any warnings and/or errors resulting from a check
performed during initialization of the DiffieHellman
object.
The following values are valid for this property (as defined in constants
module):
DH_CHECK_P_NOT_SAFE_PRIME
DH_CHECK_P_NOT_PRIME
DH_UNABLE_TO_CHECK_GENERATOR
DH_NOT_SUITABLE_GENERATOR
Computes the shared secret using otherPublicKey
as the other
party's public key and returns the computed shared secret. The supplied
key is interpreted using the specified inputEncoding
, and secret is
encoded using specified outputEncoding
.
If the inputEncoding
is not
provided, otherPublicKey
is expected to be a Buffer
,TypedArray
, or DataView
.
If outputEncoding
is given a string is returned; otherwise, a Buffer
is returned.
Generates private and public Diffie-Hellman key values, 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.
Returns the Diffie-Hellman generator in the specified encoding
.
If encoding
is provided a string is
returned; otherwise a Buffer
is returned.
Returns the Diffie-Hellman prime in the specified encoding
.
If encoding
is provided a string is
returned; otherwise a Buffer
is returned.
Returns the Diffie-Hellman private key in the specified encoding
.
If encoding
is provided a
string is returned; otherwise a Buffer
is returned.
Returns the Diffie-Hellman public key in the specified encoding
.
If encoding
is provided a
string is returned; otherwise a Buffer
is returned.
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
.
Sets the Diffie-Hellman public key. If the encoding
argument is provided,publicKey
is expected
to be a string. If no encoding
is provided, publicKey
is expected
to be a Buffer
, TypedArray
, or DataView
.
Generated using TypeDoc
The
DiffieHellman
class is a utility for creating Diffie-Hellman key exchanges.Instances of the
DiffieHellman
class can be created using the createDiffieHellman function.