Modifier and Type | Field and Description |
---|---|
protected java.math.BigInteger |
k |
private byte[] |
k_array |
Modifier | Constructor and Description |
---|---|
protected |
AbstractDH() |
Modifier and Type | Method and Description |
---|---|
protected abstract byte[] |
calculateK() |
abstract byte[] |
getE() |
abstract Digest |
getHash() |
byte[] |
getK() |
abstract void |
setF(byte[] e) |
static byte[] |
stripLeadingZeroes(byte[] x)
The shared secret returned by
KeyAgreement.generateSecret()
is a byte array, which can (by chance, roughly 1 out of 256 times) begin
with zero byte (some JCE providers might strip this, though). |
public abstract void setF(byte[] e)
public abstract byte[] getE() throws java.lang.Exception
java.lang.Exception
protected abstract byte[] calculateK() throws java.lang.Exception
java.lang.Exception
public byte[] getK() throws java.lang.Exception
java.lang.Exception
public abstract Digest getHash() throws java.lang.Exception
java.lang.Exception
public static byte[] stripLeadingZeroes(byte[] x)
KeyAgreement.generateSecret()
is a byte array, which can (by chance, roughly 1 out of 256 times) begin
with zero byte (some JCE providers might strip this, though). In SSH,
the shared secret is an integer, so we need to strip the leading zero(es).x
- The original arrayjava.lang.IllegalArgumentException
- If all zeroes array