com.sshtools.j2ssh.transport.kex
Class SshMsgKexDhInit

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

public class SshMsgKexDhInit
extends SshMessage

Implements the diffie-hellman-group1-sha1 key exchange init message.

byte SSH_MSG_KEXDH_INIT
mpint e

The Diffie-Hellman key exchange provides a shared secret that can not be determined by either party alone. The key exchange is combined with a signature with the host key to provide host authentication.

The client generates a random number x (1 < x < q) and computes e = g^x mod p. The client sends e to the server.

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

Field Summary
protected static int SSH_MSG_KEXDH_INIT
          The message id for this message
 
Constructor Summary
SshMsgKexDhInit()
          Constructs the message from data received
SshMsgKexDhInit(java.math.BigInteger e)
          Constructs the message ready for sending
 
Method Summary
protected  void constructByteArray(ByteArrayWriter baw)
          Abstract method implementation to create 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 getE()
          Gets the diffie hellman e value
 java.lang.String getMessageName()
          Gets the message name for debugging
 
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_INIT

protected static final int SSH_MSG_KEXDH_INIT
The message id for this message

See Also:
Constant Field Values
Constructor Detail

SshMsgKexDhInit

public SshMsgKexDhInit(java.math.BigInteger e)
Constructs the message ready for sending

Parameters:
e - The diffie hellman e value

SshMsgKexDhInit

public SshMsgKexDhInit()
Constructs the message from data received

Method Detail

getMessageName

public java.lang.String getMessageName()
Gets the message name for debugging

Specified by:
getMessageName in class SshMessage
Returns:

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 message data.
Throws:
InvalidMessageException - Thrown is the data cannot be read.

constructByteArray

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

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

getE

public java.math.BigInteger getE()
Gets the diffie hellman e value

Returns:
The e value


Copyright © 2002 Sshtools.com. All Rights Reserved.