net.schmizz.sshj.transport.kex
Class AbstractDHG

java.lang.Object
  extended by net.schmizz.sshj.transport.kex.AbstractDHG
All Implemented Interfaces:
KeyExchange
Direct Known Subclasses:
DHG1, DHG14

public abstract class AbstractDHG
extends Object
implements KeyExchange

Base class for DHG key exchange algorithms. Implementations will only have to configure the required data on the DH class in the


Constructor Summary
AbstractDHG()
           
 
Method Summary
 byte[] getH()
           
 Digest getHash()
          The message digest used by this key exchange algorithm.
 PublicKey getHostKey()
           
 BigInteger getK()
           
 void init(Transport trans, String V_S, String V_C, byte[] I_S, byte[] I_C)
          Initialize the key exchange algorithm.
protected abstract  void initDH(DH dh)
           
 boolean next(Message msg, SSHPacket packet)
          Process the next packet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDHG

public AbstractDHG()
Method Detail

getH

public byte[] getH()
Specified by:
getH in interface KeyExchange
Returns:
the computed H parameter

getK

public BigInteger getK()
Specified by:
getK in interface KeyExchange
Returns:
the computed K parameter

getHash

public Digest getHash()
Description copied from interface: KeyExchange
The message digest used by this key exchange algorithm.

Specified by:
getHash in interface KeyExchange
Returns:
the message digest

getHostKey

public PublicKey getHostKey()
Specified by:
getHostKey in interface KeyExchange
Returns:
the host key determined from server's response packets

init

public void init(Transport trans,
                 String V_S,
                 String V_C,
                 byte[] I_S,
                 byte[] I_C)
          throws GeneralSecurityException,
                 TransportException
Description copied from interface: KeyExchange
Initialize the key exchange algorithm.

Specified by:
init in interface KeyExchange
Parameters:
trans - the transport
V_S - the server identification string
V_C - the client identification string
I_S - the server key init packet
I_C - the client key init packet
Throws:
GeneralSecurityException
TransportException - if there is an error sending a packet

next

public boolean next(Message msg,
                    SSHPacket packet)
             throws GeneralSecurityException,
                    TransportException
Description copied from interface: KeyExchange
Process the next packet

Specified by:
next in interface KeyExchange
Parameters:
msg - message identifier
packet - the packet
Returns:
a boolean indicating if the processing is complete or if more packets are to be received
Throws:
GeneralSecurityException
TransportException - if there is an error sending a packet

initDH

protected abstract void initDH(DH dh)
                        throws GeneralSecurityException
Throws:
GeneralSecurityException


Copyright © 2009-2012. All Rights Reserved.