Table of Contents

Class KeyExchangeDiffieHellmanGroupExchange

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

Provides the implementation of "diffie-hellman-group-exchange" algorithms.

public class KeyExchangeDiffieHellmanGroupExchange : KeyExchange, IKeyExchange, IDisposable

Inheritance

Implements

Inherited Members

Constructors

KeyExchangeDiffieHellmanGroupExchange(string, HashAlgorithmName)

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

public KeyExchangeDiffieHellmanGroupExchange(string name, HashAlgorithmName hashAlgorithm)

Parameters

name string

The name of the key exchange algorithm.

hashAlgorithm HashAlgorithmName

The hash algorithm to be used.

Exceptions

ArgumentNullException

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

ArgumentException

hashAlgorithm is not a valid hash algorithm.

KeyExchangeDiffieHellmanGroupExchange(string, HashAlgorithmName, uint, uint, uint)

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

public KeyExchangeDiffieHellmanGroupExchange(string name, HashAlgorithmName hashAlgorithm, uint minimumGroupSize, uint preferredGroupSize, uint maximumGroupSize)

Parameters

name string

The name of the key exchange algorithm.

hashAlgorithm HashAlgorithmName

The hash algorithm to be used.

minimumGroupSize uint

The minimum size in bits of an acceptable group.

preferredGroupSize uint

The preferred size in bits of an acceptable group.

maximumGroupSize uint

The maximum size in bits of an acceptable group.

Exceptions

ArgumentNullException

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

ArgumentException

hashAlgorithm is not a valid hash algorithm.

ArgumentOutOfRangeException

preferredGroupSize is not between minimumGroupSize and maximumGroupSize.

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.