com.maverick.sshd.components.standalone
Class DiffieHellmanGroup1Sha1Server

java.lang.Object
  extended by com.maverick.sshd.components.SshKeyExchangeServer
      extended by com.maverick.sshd.components.standalone.DiffieHellmanGroup1Sha1Server

public class DiffieHellmanGroup1Sha1Server
extends SshKeyExchangeServer

Implementation of the required SSH Transport Protocol key exchange method "diffie-hellman-group1-sha1".

Author:
Lee David Painter

Field Summary
static String DIFFIE_HELLMAN_GROUP1_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, signature, transport, useFirstPacket
 
Constructor Summary
DiffieHellmanGroup1Sha1Server()
          Construct an uninitialized instance.
 
Method Summary
protected  void calculateExchangeHash()
           Calculates the exchange hash as an SHA1 hash of the following data.
 String getAlgorithm()
          Get the algorithm name for this key exchange
 void init(TransportProtocol transport, String clientId, String serverId, byte[] clientKexInit, byte[] serverKexInit, com.maverick.ssh.components.SshPrivateKey prvkey, com.maverick.ssh.components.SshPublicKey pubkey, boolean firstPacketFollows, boolean useFirstPacket)
           
 boolean processMessage(byte[] msg)
           
 
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_GROUP1_SHA1

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

See Also:
Constant Field Values
Constructor Detail

DiffieHellmanGroup1Sha1Server

public DiffieHellmanGroup1Sha1Server()
Construct an uninitialized instance.

Method Detail

getAlgorithm

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

Specified by:
getAlgorithm in class SshKeyExchangeServer
Returns:
"diffie-hellman-group1-sha1"

init

public void init(TransportProtocol transport,
                 String clientId,
                 String serverId,
                 byte[] clientKexInit,
                 byte[] serverKexInit,
                 com.maverick.ssh.components.SshPrivateKey prvkey,
                 com.maverick.ssh.components.SshPublicKey pubkey,
                 boolean firstPacketFollows,
                 boolean useFirstPacket)
          throws IOException
Specified by:
init in class SshKeyExchangeServer
Throws:
IOException

processMessage

public boolean processMessage(byte[] msg)
                       throws com.maverick.ssh.SshException,
                              IOException
Specified by:
processMessage in class SshKeyExchangeServer
Throws:
com.maverick.ssh.SshException
IOException

calculateExchangeHash

protected void calculateExchangeHash()
                              throws com.maverick.ssh.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
  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.SshException


Copyright © 2012. All Rights Reserved.