com.maverick.sshd.components
Class SshKeyExchangeServer

java.lang.Object
  extended bycom.maverick.sshd.components.SshKeyExchangeServer
Direct Known Subclasses:
DiffieHellmanGroup14Sha1JCE, DiffieHellmanGroup14Sha1Server, DiffieHellmanGroup1Sha1JCE, DiffieHellmanGroup1Sha1Server, DiffieHellmanGroupExchangeSha1JCE, DiffieHellmanGroupExchangeSha1Server

public abstract class SshKeyExchangeServer
extends java.lang.Object

Abstract representation of an SSH key exchange.

Author:
Lee David Painter

Field Summary
protected  java.lang.String clientId
           
protected  byte[] clientKexInit
           
protected  byte[] exchangeHash
          The exchange hash produced during key exchange.
protected  boolean firstPacketFollows
           
protected  byte[] hostKey
          The server's host key.
protected  SshPrivateKey prvkey
           
protected  SshPublicKey pubkey
           
protected  java.math.BigInteger secret
          The secret value produced during key exchange.
protected  java.lang.String serverId
           
protected  byte[] serverKexInit
           
protected  byte[] signature
          The signature generated over the exchange hash
protected  TransportProtocol transport
          The transport protocol for sending/receiving messages
protected  boolean useFirstPacket
           
 
Constructor Summary
SshKeyExchangeServer()
          Contruct an uninitialized key exchange
 
Method Summary
abstract  java.lang.String getAlgorithm()
          Get the key exchange algorithm name.
 byte[] getExchangeHash()
          Get the output of the key exchange
 byte[] getHostKey()
          Get the host key supplied during key exchange.
 java.math.BigInteger getSecret()
          Get the secret value produced during key exchange.
 byte[] getSignature()
          Get the signature produced during key exchange.
 boolean hasReceivedNewKeys()
           
 boolean hasSentNewKeys()
           
abstract  void init(TransportProtocol transport, java.lang.String clientId, java.lang.String serverId, byte[] clientKexInit, byte[] serverKexInit, SshPrivateKey prvkey, SshPublicKey pubkey, boolean firstPacketFollows, boolean useFirstPacket)
          Initialize the server side key exchange.
abstract  boolean processMessage(byte[] msg)
          Process a key exchange message
 void reset()
          Reset the key exchange.
 void setReceivedNewKeys(boolean receivedNewKeys)
           
 void setSentNewKeys(boolean sentNewKeys)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

secret

protected java.math.BigInteger secret
The secret value produced during key exchange.


exchangeHash

protected byte[] exchangeHash
The exchange hash produced during key exchange.


hostKey

protected byte[] hostKey
The server's host key.


signature

protected byte[] signature
The signature generated over the exchange hash


clientId

protected java.lang.String clientId

serverId

protected java.lang.String serverId

clientKexInit

protected byte[] clientKexInit

serverKexInit

protected byte[] serverKexInit

prvkey

protected SshPrivateKey prvkey

pubkey

protected SshPublicKey pubkey

firstPacketFollows

protected boolean firstPacketFollows

useFirstPacket

protected boolean useFirstPacket

transport

protected TransportProtocol transport
The transport protocol for sending/receiving messages

Constructor Detail

SshKeyExchangeServer

public SshKeyExchangeServer()
Contruct an uninitialized key exchange

Method Detail

setReceivedNewKeys

public void setReceivedNewKeys(boolean receivedNewKeys)

setSentNewKeys

public void setSentNewKeys(boolean sentNewKeys)

hasSentNewKeys

public boolean hasSentNewKeys()

hasReceivedNewKeys

public boolean hasReceivedNewKeys()

getAlgorithm

public abstract java.lang.String getAlgorithm()
Get the key exchange algorithm name.

Returns:
the key exchange algorithm.

getExchangeHash

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

Returns:
the exchange hash output.

getHostKey

public byte[] getHostKey()
Get the host key supplied during key exchange.

Returns:
the server's host key

getSecret

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

Returns:
The secret value produced during key exchange

getSignature

public byte[] getSignature()
Get the signature produced during key exchange.

Returns:
the signature produced from the exchange hash.

init

public abstract void init(TransportProtocol transport,
                          java.lang.String clientId,
                          java.lang.String serverId,
                          byte[] clientKexInit,
                          byte[] serverKexInit,
                          SshPrivateKey prvkey,
                          SshPublicKey pubkey,
                          boolean firstPacketFollows,
                          boolean useFirstPacket)
                   throws java.io.IOException
Initialize the server side key exchange.

Parameters:
transport -
clientId -
serverId -
clientKexInit -
serverKexInit -
prvkey -
pubkey -
firstPacketFollows -
useFirstPacket -
Throws:
java.io.IOException

processMessage

public abstract boolean processMessage(byte[] msg)
                                throws SshException,
                                       java.io.IOException
Process a key exchange message

Parameters:
msg -
Returns:
boolean, indicating whether it has processed the message or not
Throws:
java.io.IOException
SshException

reset

public void reset()
Reset the key exchange.



Copyright © 2003-2008 SSHTools LTD. All Rights Reserved.