Package org.apache.sshd.common.kex
Class XDH
- java.lang.Object
-
- org.apache.sshd.common.kex.AbstractDH
-
- org.apache.sshd.common.kex.XDH
-
- All Implemented Interfaces:
CurveSizeIndicator
public abstract class XDH extends AbstractDH implements CurveSizeIndicator
Provides Diffie-Hellman SSH key exchange algorithms for the Montgomery curves specified in RFC 8731.- See Also:
- RFC 8731
-
-
Field Summary
Fields Modifier and Type Field Description protected MontgomeryCurvecurveprotected byte[]fprotected booleanraw-
Fields inherited from class org.apache.sshd.common.kex.AbstractDH
myKeyAgree
-
-
Constructor Summary
Constructors Constructor Description XDH(MontgomeryCurve curve, boolean raw)
-
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 yetintgetByteLength()Retrieves the length of a point coordinate in bytes.voidputE(Buffer buffer, byte[] e)voidputF(Buffer buffer, byte[] f)voidsetF(byte[] f)-
Methods inherited from class org.apache.sshd.common.kex.AbstractDH
checkKeyAgreementNecessity, getE, getHash, getK, getKeyEncapsulation, isPublicDataAvailable, isSharedSecretAvailable, stripLeadingZeroes, toString
-
-
-
-
Field Detail
-
curve
protected final MontgomeryCurve curve
-
raw
protected final boolean raw
-
f
protected byte[] f
-
-
Constructor Detail
-
XDH
public XDH(MontgomeryCurve curve, boolean raw) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-
Method Detail
-
getByteLength
public int getByteLength()
Description copied from interface:CurveSizeIndicatorRetrieves the length of a point coordinate in bytes.- Specified by:
getByteLengthin interfaceCurveSizeIndicator- Returns:
- the length
-
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
-
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
-
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
-
-