com.sshtools.j2ssh.transport.kex
Class KeyExchangeState

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

public class KeyExchangeState
extends java.lang.Object

The key exchange state object is synchronized so that a thread can wait for the key exchange to complete (or fail)

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

Field Summary
static int COMPLETE
          The key exchange completed
static int FAILED
          The key exchange failed.
static int IN_PROGRESS
          The key exchange is currently in progress
 
Constructor Summary
KeyExchangeState()
          Constructs the KeyExchangeState
 
Method Summary
 byte[] getExchangeHash()
          Gets the exchange hash output of the key exchange
 java.lang.String getFailureReason()
          Gets the failure reason
 byte[] getHostKey()
          Gets the host key supplied by the server during key exchange
 java.math.BigInteger getSecret()
          Gets the secret value produced during key exchange
 byte[] getSignature()
          Gets the signature supplied during key exchange
 int getState()
          Gets the current state of the key exchange
 void setComplete(byte[] exchangeHash, byte[] hostKey, byte[] signature, java.math.BigInteger secret)
          Sets the key exchange to complete
 void setFailed(java.lang.String reason)
          Sets the state to failed
 void waitForCompletion()
          A Thread can call this method to wait for the completetion of key exchange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IN_PROGRESS

public static final int IN_PROGRESS
The key exchange is currently in progress

See Also:
Constant Field Values

COMPLETE

public static final int COMPLETE
The key exchange completed

See Also:
Constant Field Values

FAILED

public static final int FAILED
The key exchange failed. Use getFailedReason to examine the failure reason.

See Also:
Constant Field Values
Constructor Detail

KeyExchangeState

public KeyExchangeState()
Constructs the KeyExchangeState

Method Detail

getExchangeHash

public byte[] getExchangeHash()
Gets the exchange hash output of the key exchange

Returns:

getHostKey

public byte[] getHostKey()
Gets the host key supplied by the server during key exchange

Returns:

getSignature

public byte[] getSignature()
Gets the signature supplied during key exchange

Returns:

getState

public int getState()
Gets the current state of the key exchange

Returns:

getSecret

public java.math.BigInteger getSecret()
Gets the secret value produced during key exchange

Returns:

setComplete

public final void setComplete(byte[] exchangeHash,
                              byte[] hostKey,
                              byte[] signature,
                              java.math.BigInteger secret)
Sets the key exchange to complete

Parameters:
exchangeHash - The hash output
hostKey - The servers host key
signature - The signature to verify the host key with
secret - The secret key exchange value

setFailed

public final void setFailed(java.lang.String reason)
Sets the state to failed

Parameters:
reason - The reason for failure

waitForCompletion

public final void waitForCompletion()
A Thread can call this method to wait for the completetion of key exchange


getFailureReason

public java.lang.String getFailureReason()
Gets the failure reason

Returns:


Copyright © 2002 Sshtools.com. All Rights Reserved.