Xceed .NET Libraries Documentation
Xceed.SSH.Protocols Assembly / Xceed.SSH.Protocols Namespace / SSHTransportLayerProtocol Class / KeyExchange Method / KeyExchange(Byte[],Byte[],ISSHKeyExchangeAlgorithm,ISSHPublicKeyAlgorithm,ISSHEncryptionAlgorithm,ISSHEncryptionAlgorithm,ISSHDataIntegrityAlgorithm,ISSHDataIntegrityAlgorithm,ISSHCompressionAlgorithm,ISSHCompressionAlgorithm) Method


In This Topic
    KeyExchange(Byte[],Byte[],ISSHKeyExchangeAlgorithm,ISSHPublicKeyAlgorithm,ISSHEncryptionAlgorithm,ISSHEncryptionAlgorithm,ISSHDataIntegrityAlgorithm,ISSHDataIntegrityAlgorithm,ISSHCompressionAlgorithm,ISSHCompressionAlgorithm) Method
    In This Topic
    RFC 4253: Section 7. KeyExchange Key exchange (kex) begins by each side sending name-lists of supported algorithms. Each side has a preferred algorithm in each category, and it is assumed that most implementations, at any given time, will use the same preferred algorithm. Each side MAY guess which algorithm the other side is using, and MAY send an initial key exchange packet according to the algorithm, if appropriate for the preferred method. The guess is considered wrong if: o the kex algorithm and/or the host key algorithm is guessed wrong (server and client have different preferred algorithm), or o if any of the other algorithms cannot be agreed upon (the procedure is defined below in Section 7.1). Otherwise, the guess is considered to be right, and the optimistically sent packet MUST be handled as the first key exchange packet. However, if the guess was wrong, and a packet was optimistically sent by one or both parties, such packets MUST be ignored (even if the error in the guess would not affect the contents of the initial packet(s)), and the appropriate side MUST send the correct initial packet. A key exchange method uses explicit server authentication if the key exchange messages include a signature or other proof of the server's authenticity. A key exchange method uses implicit server authentication if, in order to prove its authenticity, the server also has to prove that it knows the shared secret, K, by sending a message and a corresponding MAC that the client can verify. The key exchange method defined by this document uses explicit server authentication. However, key exchange methods with implicit server authentication MAY be used with this protocol. After a key exchange with implicit server authentication, the client MUST wait for a response to its service request message before sending any further data.
    Syntax
    'Usage
     
    
    Dim instance As SSHTransportLayerProtocol
    Dim sharedSecret() As Byte
    Dim exchangeHash() As Byte
    Dim keyExchangeAlgorithm As ISSHKeyExchangeAlgorithm
    Dim publicKeyAlgorithm As ISSHPublicKeyAlgorithm
    Dim encryptionAlgorithmClientToServer As ISSHEncryptionAlgorithm
    Dim encryptionAlgorithmServerToClient As ISSHEncryptionAlgorithm
    Dim dataIntegrityAlgorithmClientToServer As ISSHDataIntegrityAlgorithm
    Dim dataIntegrityAlgorithmServerToClient As ISSHDataIntegrityAlgorithm
    Dim compressionAlgorithmClientToServer As ISSHCompressionAlgorithm
    Dim compressionAlgorithmServerToClient As ISSHCompressionAlgorithm
     
    instance.KeyExchange(sharedSecret, exchangeHash, keyExchangeAlgorithm, publicKeyAlgorithm, encryptionAlgorithmClientToServer, encryptionAlgorithmServerToClient, dataIntegrityAlgorithmClientToServer, dataIntegrityAlgorithmServerToClient, compressionAlgorithmClientToServer, compressionAlgorithmServerToClient)

    Parameters

    sharedSecret
    exchangeHash
    keyExchangeAlgorithm
    publicKeyAlgorithm
    encryptionAlgorithmClientToServer
    encryptionAlgorithmServerToClient
    dataIntegrityAlgorithmClientToServer
    dataIntegrityAlgorithmServerToClient
    compressionAlgorithmClientToServer
    compressionAlgorithmServerToClient
    Supported Frameworks

    .NET: net5.0, net5.0-windows, net6.0, net6.0-macos, net6.0-windows, net7.0, net7.0-macos, net7.0-windows, net8.0, net8.0-browser, net8.0-macos, net8.0-windows, net9.0, net9.0-browser, net9.0-macos, net9.0-windows, net10.0, net10.0-browser, net10.0-macos, net10.0-windows.

    .NET Standard: netstandard2.0, netstandard2.1

    .NET Framework: net20, net35, net40, net403, net45, net451, net452, net46, net461, net462, net463, net47, net471, net472, net48, net481.

    See Also