com.mindbright.ssh2
Class SSH2KEXECDHSHA2NIST

java.lang.Object
  extended by com.mindbright.ssh2.SSH2KeyExchanger
      extended by com.mindbright.ssh2.SSH2KEXECDHSHA2NIST
Direct Known Subclasses:
SSH2KEXECDHSHA2NIST.P256, SSH2KEXECDHSHA2NIST.P384, SSH2KEXECDHSHA2NIST.P521

public abstract class SSH2KEXECDHSHA2NIST
extends SSH2KeyExchanger

Base class for ECC DH key exchange as defined in RFC 5656


Nested Class Summary
static class SSH2KEXECDHSHA2NIST.P256
           
static class SSH2KEXECDHSHA2NIST.P384
           
static class SSH2KEXECDHSHA2NIST.P521
           
 
Field Summary
protected  java.security.spec.ECPoint clientE
           
protected  java.security.interfaces.ECPrivateKey ecPrivateKey
           
protected  java.security.interfaces.ECPublicKey ecPublicKey
           
protected  byte[] exchangeHash_H
           
protected  java.security.spec.ECPoint serverF
           
protected  byte[] serverHostKey
           
protected  java.security.KeyPair serverKey
           
protected  java.security.MessageDigest sha2
           
protected  byte[] sharedSecret_K
           
protected  SSH2Transport transport
           
 
Constructor Summary
SSH2KEXECDHSHA2NIST()
           
 
Method Summary
protected  void computeExchangeHash_H()
           
protected  void computeSharedSecret_K(java.security.spec.ECPoint point)
           
protected  java.security.MessageDigest createHash()
           
static java.security.spec.ECPoint frombytes(byte[] b, java.security.spec.EllipticCurve curve)
           
protected  void generateECKeyPair()
           
abstract  java.lang.String getECName()
           
 byte[] getExchangeHash_H()
           
 java.security.MessageDigest getExchangeHashAlgorithm()
           
abstract  java.lang.String getHashName()
           
abstract  java.lang.String getName()
           
 byte[] getSharedSecret_K()
           
 void init(SSH2Transport transport)
           
 void init(SSH2Transport transport, java.security.KeyPair serverKey)
           
 void processKEXMethodPDU(SSH2TransportPDU pdu)
           
protected  void sendECDHINIT(int type)
           
static byte[] tobytes(java.security.spec.ECPoint e, java.security.spec.EllipticCurve curve)
           
 
Methods inherited from class com.mindbright.ssh2.SSH2KeyExchanger
getHostKeyAlgorithms, getInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

transport

protected SSH2Transport transport

ecPublicKey

protected java.security.interfaces.ECPublicKey ecPublicKey

ecPrivateKey

protected java.security.interfaces.ECPrivateKey ecPrivateKey

serverHostKey

protected byte[] serverHostKey

serverF

protected java.security.spec.ECPoint serverF

clientE

protected java.security.spec.ECPoint clientE

sharedSecret_K

protected byte[] sharedSecret_K

exchangeHash_H

protected byte[] exchangeHash_H

sha2

protected java.security.MessageDigest sha2

serverKey

protected java.security.KeyPair serverKey
Constructor Detail

SSH2KEXECDHSHA2NIST

public SSH2KEXECDHSHA2NIST()
Method Detail

getName

public abstract java.lang.String getName()

getECName

public abstract java.lang.String getECName()

getHashName

public abstract java.lang.String getHashName()

init

public void init(SSH2Transport transport)
          throws SSH2Exception
Specified by:
init in class SSH2KeyExchanger
Throws:
SSH2Exception

init

public void init(SSH2Transport transport,
                 java.security.KeyPair serverKey)
          throws SSH2Exception
Throws:
SSH2Exception

tobytes

public static byte[] tobytes(java.security.spec.ECPoint e,
                             java.security.spec.EllipticCurve curve)

frombytes

public static java.security.spec.ECPoint frombytes(byte[] b,
                                                   java.security.spec.EllipticCurve curve)

processKEXMethodPDU

public void processKEXMethodPDU(SSH2TransportPDU pdu)
                         throws SSH2Exception
Specified by:
processKEXMethodPDU in class SSH2KeyExchanger
Throws:
SSH2Exception

getExchangeHashAlgorithm

public java.security.MessageDigest getExchangeHashAlgorithm()
Specified by:
getExchangeHashAlgorithm in class SSH2KeyExchanger

getSharedSecret_K

public byte[] getSharedSecret_K()
Specified by:
getSharedSecret_K in class SSH2KeyExchanger

getExchangeHash_H

public byte[] getExchangeHash_H()
Specified by:
getExchangeHash_H in class SSH2KeyExchanger

computeExchangeHash_H

protected void computeExchangeHash_H()

computeSharedSecret_K

protected void computeSharedSecret_K(java.security.spec.ECPoint point)
                              throws SSH2Exception
Throws:
SSH2Exception

sendECDHINIT

protected void sendECDHINIT(int type)
                     throws SSH2Exception
Throws:
SSH2Exception

createHash

protected java.security.MessageDigest createHash()
                                          throws SSH2Exception
Throws:
SSH2Exception

generateECKeyPair

protected void generateECKeyPair()
                          throws SSH2Exception
Throws:
SSH2Exception