Table of Contents

Class KeyExchangeDiffieHellman

Namespace
Renci.SshNet.Security
Assembly
Renci.SshNet.dll

Provides the implementation of "diffie-hellman-groupN" algorithms.

public class KeyExchangeDiffieHellman : KeyExchange, IKeyExchange, IDisposable

Inheritance

Implements

Inherited Members

Constructors

KeyExchangeDiffieHellman(string, DHParameters, HashAlgorithmName)

Initializes a new instance of the Renci.SshNet.Security.KeyExchangeDiffieHellman class.

public KeyExchangeDiffieHellman(string name, DHParameters parameters, HashAlgorithmName hashAlgorithm)

Parameters

name string

The name of the key exchange algorithm.

parameters DHParameters

The Diffie-Hellman parameters to be used.

hashAlgorithm HashAlgorithmName

The hash algorithm to be used.

Exceptions

ArgumentNullException

name, parameters, or System.Security.Cryptography.HashAlgorithmName.Name is null.

ArgumentException

hashAlgorithm is not a valid hash algorithm.

Properties

Name

Gets the algorithm name.

public override string Name { get; }

Property Value

string

Methods

CalculateHash()

Calculates key exchange hash value.

protected override byte[] CalculateHash()

Returns

byte[]

Key exchange hash.

Dispose(bool)

Releases unmanaged and - optionally - managed resources.

protected override void Dispose(bool disposing)

Parameters

disposing bool

true to release both managed and unmanaged resources; false to release only unmanaged resources.

Hash(byte[])

Hashes the specified data bytes.

protected override byte[] Hash(byte[] hashData)

Parameters

hashData byte[]

The hash data.

Returns

byte[]

The hash of the data.

Start(Session, KeyExchangeInitMessage, bool)

Starts the key exchange algorithm.

public override void Start(Session session, KeyExchangeInitMessage message, bool sendClientInitMessage)

Parameters

session Session

The session.

message KeyExchangeInitMessage

The key exchange init message received from the server.

sendClientInitMessage bool

Whether to send a key exchange init message in response.

ValidateExchangeHash()

Validates the exchange hash.

protected override bool ValidateExchangeHash()

Returns

bool

true if exchange hash is valid; otherwise false.