com.sshtools.j2ssh.transport.kex
Class SshMsgKexDhReply

java.lang.Object
  |
  +--com.sshtools.j2ssh.transport.SshMessage
        |
        +--com.sshtools.j2ssh.transport.kex.SshMsgKexDhReply

public class SshMsgKexDhReply
extends SshMessage

The server responds to a SSH_MSG_KEXDH_INIT with the following:

byte SSH_MSG_KEXDH_REPLY
string server public host key and certificates (K_S)
mpint f
string signature of H

The hash H is computed as the HASH hash of the concatenation of the following:

string V_C, the client's version string (CR and NL excluded)
string V_S, the server's version string (CR and NL excluded)
string I_C, the payload of the client's SSH_MSG_KEXINIT
string I_S, the payload of the server's SSH_MSG_KEXINIT
string K_S, the host key
mpint e, exchange value sent by the client
mpint f, exchange value sent by the server
mpint K, the shared secret

This value is called the exchange hash, and it is used to authenticate the key exchange. The exchange hash SHOULD be kept secret.

The signature algorithm MUST be applied over H, not the original data. Most signature algorithms include hashing and additional padding. For example, "ssh-dss" specifies SHA-1 hashing; in that case, the data is first hashed with HASH to compute H, and H is then hashed with SHA-1 as part of the signing operation.

Version:
1.0
Author:
Lee David Painter ( lee@sshtools.com )

Field Summary
protected static int SSH_MSG_KEXDH_REPLY
          The message id of the message
 
Constructor Summary
SshMsgKexDhReply()
          Constructs the message from data received.
SshMsgKexDhReply(byte[] hostKey, java.math.BigInteger f, byte[] signature)
          Constructs the message ready for sending.
 
Method Summary
protected  void constructByteArray(ByteArrayWriter baw)
          Abstract method implementation to construct a byte array containing the message.
protected  void constructMessage(ByteArrayReader bar)
          Abstract method implementation to construct the message from a byte array.
 java.math.BigInteger getF()
          Gets the f attribute of the message
 byte[] getHostKey()
          Gets the hostKey attribute of the message
 java.lang.String getMessageName()
          Gets the messageName attribute of the SshMsgKexDhReply object
 byte[] getSignature()
          Gets the signature attribute of the message
 
Methods inherited from class com.sshtools.j2ssh.transport.SshMessage
fromByteArray, getMessageId, toByteArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SSH_MSG_KEXDH_REPLY

protected static final int SSH_MSG_KEXDH_REPLY
The message id of the message

See Also:
Constant Field Values
Constructor Detail

SshMsgKexDhReply

public SshMsgKexDhReply(byte[] hostKey,
                        java.math.BigInteger f,
                        byte[] signature)
Constructs the message ready for sending.

Parameters:
hostKey - The servers host key data
f - The diffie hellman f value
signature - The signature to verify ownership of a private key

SshMsgKexDhReply

public SshMsgKexDhReply()
Constructs the message from data received.

Method Detail

getMessageName

public java.lang.String getMessageName()
Gets the messageName attribute of the SshMsgKexDhReply object

Specified by:
getMessageName in class SshMessage
Returns:
The messageName value

constructMessage

protected void constructMessage(ByteArrayReader bar)
                         throws InvalidMessageException
Abstract method implementation to construct the message from a byte array.

Specified by:
constructMessage in class SshMessage
Parameters:
bar - The byte array containing the data.
Throws:
InvalidMessageException - Thrown if the data cannot be read.

constructByteArray

protected void constructByteArray(ByteArrayWriter baw)
                           throws InvalidMessageException
Abstract method implementation to construct a byte array containing the message.

Specified by:
constructByteArray in class SshMessage
Parameters:
baw - The byte array being written to.
Throws:
InvalidMessageException - Thrown if the data cannot be written.

getHostKey

public byte[] getHostKey()
Gets the hostKey attribute of the message

Returns:
The hostKey value

getF

public java.math.BigInteger getF()
Gets the f attribute of the message

Returns:
The f value

getSignature

public byte[] getSignature()
Gets the signature attribute of the message

Returns:
The signature value


Copyright © 2002 Sshtools.com. All Rights Reserved.