Package org.apache.sshd.common.kex
Class ECDH
- java.lang.Object
-
- org.apache.sshd.common.kex.AbstractDH
-
- org.apache.sshd.common.kex.ECDH
-
public class ECDH extends AbstractDH
Elliptic Curve Diffie-Hellman key agreement.
-
-
Field Summary
Fields Modifier and Type Field Description private ECCurvescurveprivate java.security.spec.ECPointfstatic java.lang.StringKEX_TYPEprivate java.security.spec.ECParameterSpecparams-
Fields inherited from class org.apache.sshd.common.kex.AbstractDH
myKeyAgree
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected byte[]calculateE()Lazy-called byAbstractDH.getE()if the public key data has not been generated yet.protected byte[]calculateK()Lazy-called byAbstractDH.getK()if the shared secret data has not been calculated yetDigestgetHash()voidputE(Buffer buffer, byte[] e)voidputF(Buffer buffer, byte[] f)voidsetCurveParameters(java.security.spec.ECParameterSpec paramSpec)voidsetF(byte[] f)java.lang.StringtoString()-
Methods inherited from class org.apache.sshd.common.kex.AbstractDH
checkKeyAgreementNecessity, getE, getK, isPublicDataAvailable, isSharedSecretAvailable, stripLeadingZeroes
-
-
-
-
Field Detail
-
KEX_TYPE
public static final java.lang.String KEX_TYPE
- See Also:
- Constant Field Values
-
curve
private ECCurves curve
-
params
private java.security.spec.ECParameterSpec params
-
f
private java.security.spec.ECPoint f
-
-
Constructor Detail
-
ECDH
public ECDH() throws java.lang.Exception- Throws:
java.lang.Exception
-
ECDH
public ECDH(java.lang.String curveName) throws java.lang.Exception- Throws:
java.lang.Exception
-
ECDH
public ECDH(ECCurves curve) throws java.lang.Exception
- Throws:
java.lang.Exception
-
ECDH
public ECDH(java.security.spec.ECParameterSpec paramSpec) throws java.lang.Exception- Throws:
java.lang.Exception
-
-
Method Detail
-
calculateE
protected byte[] calculateE() throws java.lang.ExceptionDescription copied from class:AbstractDHLazy-called byAbstractDH.getE()if the public key data has not been generated yet.- Specified by:
calculateEin classAbstractDH- Returns:
- The calculated public key data
- Throws:
java.lang.Exception- If failed to generate the relevant data
-
calculateK
protected byte[] calculateK() throws java.lang.ExceptionDescription copied from class:AbstractDHLazy-called byAbstractDH.getK()if the shared secret data has not been calculated yet- Specified by:
calculateKin classAbstractDH- Returns:
- The shared secret data
- Throws:
java.lang.Exception- If failed to calculate it
-
setCurveParameters
public void setCurveParameters(java.security.spec.ECParameterSpec paramSpec)
-
setF
public void setF(byte[] f)
- Specified by:
setFin classAbstractDH
-
putE
public void putE(Buffer buffer, byte[] e)
- Overrides:
putEin classAbstractDH
-
putF
public void putF(Buffer buffer, byte[] f)
- Overrides:
putFin classAbstractDH
-
getHash
public Digest getHash() throws java.lang.Exception
- Specified by:
getHashin classAbstractDH- Throws:
java.lang.Exception
-
toString
public java.lang.String toString()
- Overrides:
toStringin classAbstractDH
-
-