com.sshtools.j2ssh.transport.kex
Class SshKeyExchange

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

public abstract class SshKeyExchange
extends java.lang.Object
implements java.lang.Runnable

This class provides a framework for implementing SSH protocol key exchange methods for the API.

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

Field Summary
protected  SshMessageStore messageStore
          The methods message store
 
Constructor Summary
SshKeyExchange()
          Constructor for the KeyExchange object
 
Method Summary
 KeyExchangeState getState()
          Gets the state of the key exchange
abstract  void init(TransportProtocol transport, java.lang.String clientId, java.lang.String serverId, byte[] clientKexInit, byte[] serverKexInit)
          Initiates the key exchange object before starting
protected abstract  void onMessageReceived(SshMessage msg)
          Called by the framwork when a registered message is recieved.
 void run()
          Main processing method for the KeyExchange object
protected  void setComplete(byte[] exchangeHash, byte[] hostKey, byte[] signature, java.math.BigInteger secret)
          Sets the key exchanges state to complete
protected  void setFailed(java.lang.String reason)
          Sets the key exchanges state to failed
abstract  void startClient()
          Starts the client side of the key exchange
abstract  void startServer()
          Starts the server side of the key exchange
 void stop()
          Stops the key exchange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

messageStore

protected SshMessageStore messageStore
The methods message store

Constructor Detail

SshKeyExchange

public SshKeyExchange()
Constructor for the KeyExchange object

Method Detail

setComplete

protected void setComplete(byte[] exchangeHash,
                           byte[] hostKey,
                           byte[] signature,
                           java.math.BigInteger secret)
Sets the key exchanges state to complete

Parameters:
exchangeHash - The output of the key exchange
hostKey - The servers host key
signature - The signature
secret - The secret value output of the key exchange

setFailed

protected void setFailed(java.lang.String reason)
Sets the key exchanges state to failed

Parameters:
reason - The new failed value

getState

public KeyExchangeState getState()
Gets the state of the key exchange

Returns:

run

public void run()
Main processing method for the KeyExchange object

Specified by:
run in interface java.lang.Runnable

stop

public void stop()
Stops the key exchange


init

public abstract void init(TransportProtocol transport,
                          java.lang.String clientId,
                          java.lang.String serverId,
                          byte[] clientKexInit,
                          byte[] serverKexInit)
Initiates the key exchange object before starting

Parameters:
transport - The transport protocol for sending/receiving
clientId - The clients identification string
serverId - The servers identification string
clientKexInit - The clients SSH_MSG_KEX_INIT payload
serverKexInit - The servers SSH_MSG_KEX_INIT payload

startClient

public abstract void startClient()
                          throws KeyExchangeException
Starts the client side of the key exchange

Throws:
KeyExchangeException - Throw if a key exchange error occures

startServer

public abstract void startServer()
                          throws KeyExchangeException
Starts the server side of the key exchange

Throws:
KeyExchangeException - Throw if a key exchange error occurs

onMessageReceived

protected abstract void onMessageReceived(SshMessage msg)
                                   throws KeyExchangeException
Called by the framwork when a registered message is recieved.

Parameters:
msg - The message received
Throws:
KeyExchangeException - Description of the Exception


Copyright © 2002 Sshtools.com. All Rights Reserved.