com.maverick.sshd.components.jce
Class DiffieHellmanGroupExchangeSha1JCE

java.lang.Object
  extended by com.maverick.sshd.components.SshKeyExchangeServer
      extended by com.maverick.sshd.components.jce.DiffieHellmanGroupExchangeSha1JCE
All Implemented Interfaces:
com.maverick.ssh.components.jce.AbstractKeyExchange, com.maverick.ssh.components.SshComponent

public class DiffieHellmanGroupExchangeSha1JCE
extends SshKeyExchangeServer
implements com.maverick.ssh.components.jce.AbstractKeyExchange


Field Summary
static String DIFFIE_HELLMAN_GROUP_EXCHANGE_SHA1
          Constant for the algorithm name "diffie-hellman-group1-sha1".
 
Fields inherited from class com.maverick.sshd.components.SshKeyExchangeServer
clientId, clientKexInit, exchangeHash, firstPacketFollows, hostKey, prvkey, pubkey, secret, serverId, serverKexInit, session, signature, transport, useFirstPacket
 
Constructor Summary
DiffieHellmanGroupExchangeSha1JCE()
          Construct an uninitialized instance.
 
Method Summary
protected  void calculateExchangeHash()
          Calculates the exchange hash as an SHA1 hash of the following data.
 boolean exchangeGroup(byte[] msg)
           
 String getName()
          Get the algorithm name for this key exchange
 String getProvider()
           
 void init(org.apache.mina.core.session.IoSession session, SshTransport transport, String clientIdentification, String serverIdentification, byte[] clientKexInit, byte[] serverKexInit, com.maverick.ssh.components.SshPrivateKey prvkey, com.maverick.ssh.components.SshPublicKey pubkey, boolean firstPacketFollows, boolean useFirstPacket)
          Initialize the server side key exchange.
 boolean processMessage(byte[] msg)
          Process a key exchange message
 
Methods inherited from class com.maverick.sshd.components.SshKeyExchangeServer
getExchangeHash, getHostKey, getSecret, getSignature, hasReceivedNewKeys, hasSentNewKeys, reset, setReceivedNewKeys, setSentNewKeys
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIFFIE_HELLMAN_GROUP_EXCHANGE_SHA1

public static final String DIFFIE_HELLMAN_GROUP_EXCHANGE_SHA1
Constant for the algorithm name "diffie-hellman-group1-sha1".

See Also:
Constant Field Values
Constructor Detail

DiffieHellmanGroupExchangeSha1JCE

public DiffieHellmanGroupExchangeSha1JCE()
Construct an uninitialized instance.

Method Detail

getName

public String getName()
Get the algorithm name for this key exchange

Specified by:
getName in interface com.maverick.ssh.components.SshComponent
Specified by:
getName in class SshKeyExchangeServer
Returns:
"diffie-hellman-group1-sha1"

init

public void init(org.apache.mina.core.session.IoSession session,
                 SshTransport transport,
                 String clientIdentification,
                 String serverIdentification,
                 byte[] clientKexInit,
                 byte[] serverKexInit,
                 com.maverick.ssh.components.SshPrivateKey prvkey,
                 com.maverick.ssh.components.SshPublicKey pubkey,
                 boolean firstPacketFollows,
                 boolean useFirstPacket)
          throws IOException
Description copied from class: SshKeyExchangeServer
Initialize the server side key exchange.

Specified by:
init in class SshKeyExchangeServer
Throws:
IOException

getProvider

public String getProvider()
Specified by:
getProvider in interface com.maverick.ssh.components.jce.AbstractKeyExchange

exchangeGroup

public boolean exchangeGroup(byte[] msg)
                      throws com.maverick.ssh.common.SshException,
                             IOException
Throws:
com.maverick.ssh.common.SshException
IOException

processMessage

public boolean processMessage(byte[] msg)
                       throws com.maverick.ssh.common.SshException,
                              IOException
Description copied from class: SshKeyExchangeServer
Process a key exchange message

Specified by:
processMessage in class SshKeyExchangeServer
Returns:
boolean, indicating whether it has processed the message or not
Throws:
IOException
com.maverick.ssh.common.SshException

calculateExchangeHash

protected void calculateExchangeHash()
                              throws com.maverick.ssh.common.SshException

Calculates the exchange hash as an SHA1 hash of the following data.

  String         the client's version string (CR and NL excluded)
  String         the server's version string (CR and NL excluded)
  String         the payload of the client's SSH_MSG_KEXINIT
  String         the payload of the server's SSH_MSG_KEXINIT
  String         the host key
  UnsignedInteger32     min
  UnsignedInteger32     n
  UnsignedInteger32     max
  BigInteger    p
  BigInteger    g
  BigInteger     e, exchange value sent by the client
  BigInteger     f, exchange value sent by the server
  BigInteger     K, the shared secret
 

Throws:
IOException
com.maverick.ssh.common.SshException


Copyright © 2012. All Rights Reserved.