Modifier and Type | Field and Description |
---|---|
protected KeyAgreement |
myKeyAgree |
Modifier | Constructor and Description |
---|---|
protected |
AbstractDH() |
Modifier and Type | Method and Description |
---|---|
protected abstract byte[] |
calculateE()
Lazy-called by
getE() if the public key data has not been generated yet. |
protected abstract byte[] |
calculateK()
Lazy-called by
getK() if the shared secret data has not been calculated yet |
protected void |
checkKeyAgreementNecessity()
Called after either public or private parts have been calculated in order to check if the key-agreement mediator
is still required.
|
byte[] |
getE() |
abstract Digest |
getHash() |
byte[] |
getK() |
boolean |
isPublicDataAvailable() |
boolean |
isSharedSecretAvailable() |
void |
putE(Buffer buffer,
byte[] e) |
void |
putF(Buffer buffer,
byte[] f) |
abstract void |
setF(byte[] f) |
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). |
String |
toString() |
protected KeyAgreement myKeyAgree
public abstract void setF(byte[] f)
public boolean isPublicDataAvailable()
protected abstract byte[] calculateE() throws Exception
getE()
if the public key data has not been generated yet.Exception
- If failed to generate the relevant datapublic byte[] getE() throws Exception
Exception
- If failed to calculate itpublic void putE(Buffer buffer, byte[] e)
public void putF(Buffer buffer, byte[] f)
public boolean isSharedSecretAvailable()
protected abstract byte[] calculateK() throws Exception
getK()
if the shared secret data has not been calculated yetException
- If failed to calculate itpublic byte[] getK() throws Exception
Exception
- If failed to calculate itprotected void checkKeyAgreementNecessity()
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 arrayIllegalArgumentException
- If all zeroes arrayCopyright © 2008–2024 The Apache Software Foundation. All rights reserved.