com.sshtools.j2ssh.transport.kex
Class DhGroup1Sha1

java.lang.Object
  |
  +--com.sshtools.j2ssh.transport.kex.SshKeyExchange
        |
        +--com.sshtools.j2ssh.transport.kex.DhGroup1Sha1
All Implemented Interfaces:
java.lang.Runnable

public class DhGroup1Sha1
extends SshKeyExchange

Implements the diffie-hellman-group1-sha1 key exchange method as described in the transport protocol specification [SSH-TRANS]

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

Field Summary
 
Fields inherited from class com.sshtools.j2ssh.transport.kex.SshKeyExchange
messageStore
 
Constructor Summary
DhGroup1Sha1()
          Constructor for the DhGroup1Sha1 object
 
Method Summary
protected  byte[] calculateExchangeHash(byte[] hostKey)
          This method is during key exchange to calculate the exchange hash The exchange hash is computed as the concatenation of the following: The clients identification string, The servers identification string, The payload of the clients SSH_MSG_KEXINIT, The payload of the servers SSH_MSG_KEX_INIT, The servers host key, The diffie hellman e value, The diffie hellman f value, The diffie hellman k value.
 void init(TransportProtocol transport, java.lang.String clientId, java.lang.String serverId, byte[] clientKexInit, byte[] serverKexInit)
          Called by the framework to initate the key exchange.
protected  void onMessageReceived(SshMessage msg)
          Called by the framework when a registered message is received.
 void startClient()
          Called by the framework to start the client side of the key exchange method.
 void startServer()
          Called by the framework to start the server side of the key exchange
 
Methods inherited from class com.sshtools.j2ssh.transport.kex.SshKeyExchange
getState, run, setComplete, setFailed, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DhGroup1Sha1

public DhGroup1Sha1()
Constructor for the DhGroup1Sha1 object

Method Detail

init

public void init(TransportProtocol transport,
                 java.lang.String clientId,
                 java.lang.String serverId,
                 byte[] clientKexInit,
                 byte[] serverKexInit)
Called by the framework to initate the key exchange.

Specified by:
init in class SshKeyExchange
Parameters:
transport - The transport protocol object for sending/receiving
clientId - The client identication string from protocol negotiation
serverId - The servers identification string from protocol negotiation
clientKexInit - The clients SSH_MSG_KEX_INIT payload
serverKexInit - The servers SSH_MSG_KEX_INIT payload

startClient

public void startClient()
                 throws KeyExchangeException
Called by the framework to start the client side of the key exchange method.

Specified by:
startClient in class SshKeyExchange
Throws:
KeyExchangeException - Thrown if a key exchange error occurs

startServer

public void startServer()
                 throws KeyExchangeException
Called by the framework to start the server side of the key exchange

Specified by:
startServer in class SshKeyExchange
Throws:
KeyExchangeException - Thrown if a key exchange error occurs

onMessageReceived

protected void onMessageReceived(SshMessage msg)
Called by the framework when a registered message is received.

Specified by:
onMessageReceived in class SshKeyExchange
Parameters:
msg - The message received

calculateExchangeHash

protected byte[] calculateExchangeHash(byte[] hostKey)
                                throws KeyExchangeException
This method is during key exchange to calculate the exchange hash The exchange hash is computed as the concatenation of the following: The clients identification string, The servers identification string, The payload of the clients SSH_MSG_KEXINIT, The payload of the servers SSH_MSG_KEX_INIT, The servers host key, The diffie hellman e value, The diffie hellman f value, The diffie hellman k value.

Parameters:
hostKey - The servers host key
Returns:
The exchange hash output
Throws:
KeyExchangeException - Thrown if an error occurs


Copyright © 2002 Sshtools.com. All Rights Reserved.