com.maverick.ssh.components.jce
Class DiffieHellmanGroup1Sha1

java.lang.Object
  extended by com.maverick.ssh.components.SshKeyExchangeClient
      extended by com.maverick.ssh.components.jce.DiffieHellmanGroup1Sha1
All Implemented Interfaces:
AbstractKeyExchange, SshKeyExchange

public class DiffieHellmanGroup1Sha1
extends SshKeyExchangeClient
implements AbstractKeyExchange

An implementation of the diffie-hellman-group1-sha1 key exchange mechanism that uses JCE provider for DH agreement and Digest.

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.ssh.components.SshKeyExchangeClient
exchangeHash, hostKey, secret, signature, transport
 
Constructor Summary
DiffieHellmanGroup1Sha1()
          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
 String getProvider()
           
 boolean isKeyExchangeMessage(int messageid)
           
 void performClientExchange(String clientIdentification, String serverIdentification, byte[] clientKexInit, byte[] serverKexInit)
           
 
Methods inherited from class com.maverick.ssh.components.SshKeyExchangeClient
getExchangeHash, getHostKey, getSecret, getSignature, init, reset
 
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

DiffieHellmanGroup1Sha1

public DiffieHellmanGroup1Sha1()
Construct an uninitialized instance.

Method Detail

getAlgorithm

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

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

getProvider

public String getProvider()
Specified by:
getProvider in interface AbstractKeyExchange

performClientExchange

public void performClientExchange(String clientIdentification,
                                  String serverIdentification,
                                  byte[] clientKexInit,
                                  byte[] serverKexInit)
                           throws SshException
Specified by:
performClientExchange in class SshKeyExchangeClient
Throws:
SshException

calculateExchangeHash

protected void calculateExchangeHash()
                              throws 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
SshException

isKeyExchangeMessage

public boolean isKeyExchangeMessage(int messageid)
Specified by:
isKeyExchangeMessage in class SshKeyExchangeClient


Copyright © 2012. All Rights Reserved.