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 ECCurves
curve
private java.security.spec.ECPoint
f
static java.lang.String
KEX_TYPE
private java.security.spec.ECParameterSpec
params
-
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 yetDigest
getHash()
void
putE(Buffer buffer, byte[] e)
void
putF(Buffer buffer, byte[] f)
void
setCurveParameters(java.security.spec.ECParameterSpec paramSpec)
void
setF(byte[] f)
java.lang.String
toString()
-
Methods inherited from class org.apache.sshd.common.kex.AbstractDH
checkKeyAgreementNecessity, getE, getK, getKeyEncapsulation, 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.Exception
Description copied from class:AbstractDH
Lazy-called byAbstractDH.getE()
if the public key data has not been generated yet.- Specified by:
calculateE
in 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.Exception
Description copied from class:AbstractDH
Lazy-called byAbstractDH.getK()
if the shared secret data has not been calculated yet- Specified by:
calculateK
in 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:
setF
in classAbstractDH
-
putE
public void putE(Buffer buffer, byte[] e)
- Overrides:
putE
in classAbstractDH
-
putF
public void putF(Buffer buffer, byte[] f)
- Overrides:
putF
in classAbstractDH
-
getHash
public Digest getHash() throws java.lang.Exception
- Specified by:
getHash
in classAbstractDH
- Throws:
java.lang.Exception
-
toString
public java.lang.String toString()
- Overrides:
toString
in classAbstractDH
-
-