Package org.apache.sshd.common.kex
Class DHG
- java.lang.Object
-
- org.apache.sshd.common.kex.AbstractDH
-
- org.apache.sshd.common.kex.DHG
-
public class DHG extends AbstractDH
Diffie-Hellman key generator.- Author:
- Apache MINA SSHD Project
-
-
Field Summary
Fields Modifier and Type Field Description static StringKEX_TYPE-
Fields inherited from class org.apache.sshd.common.kex.AbstractDH
myKeyAgree
-
-
Constructor Summary
Constructors Constructor Description DHG(Factory<? extends Digest> digestFactory)DHG(Factory<? extends Digest> digestFactory, BigInteger pValue, BigInteger gValue)
-
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 yetBigIntegergetG()DigestgetHash()BigIntegergetP()voidsetF(byte[] f)voidsetF(BigInteger f)voidsetG(byte[] g)voidsetG(BigInteger g)voidsetP(byte[] p)voidsetP(BigInteger p)StringtoString()-
Methods inherited from class org.apache.sshd.common.kex.AbstractDH
checkKeyAgreementNecessity, getE, getK, isPublicDataAvailable, isSharedSecretAvailable, putE, putF, stripLeadingZeroes
-
-
-
-
Field Detail
-
KEX_TYPE
public static final String KEX_TYPE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DHG
public DHG(Factory<? extends Digest> digestFactory, BigInteger pValue, BigInteger gValue) throws Exception
- Throws:
Exception
-
-
Method Detail
-
calculateE
protected byte[] calculateE() throws 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:
Exception- If failed to generate the relevant data
-
calculateK
protected byte[] calculateK() throws 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:
Exception- If failed to calculate it
-
setP
public void setP(byte[] p)
-
setG
public void setG(byte[] g)
-
setF
public void setF(byte[] f)
- Specified by:
setFin classAbstractDH
-
getP
public BigInteger getP()
-
setP
public void setP(BigInteger p)
-
getG
public BigInteger getG()
-
setG
public void setG(BigInteger g)
-
setF
public void setF(BigInteger f)
-
getHash
public Digest getHash() throws Exception
- Specified by:
getHashin classAbstractDH- Throws:
Exception
-
toString
public String toString()
- Overrides:
toStringin classAbstractDH
-
-