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 String
KEX_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 yetBigInteger
getG()
Digest
getHash()
BigInteger
getP()
void
setF(byte[] f)
void
setF(BigInteger f)
void
setG(byte[] g)
void
setG(BigInteger g)
void
setP(byte[] p)
void
setP(BigInteger p)
String
toString()
-
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 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:
Exception
- If failed to generate the relevant data
-
calculateK
protected byte[] calculateK() throws 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:
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:
setF
in 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:
getHash
in classAbstractDH
- Throws:
Exception
-
toString
public String toString()
- Overrides:
toString
in classAbstractDH
-
-