|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.router.transport.crypto.DHSessionKeyBuilder
public class DHSessionKeyBuilder
Generate a new session key through a diffie hellman exchange. This uses the constants defined in CryptoConstants, which causes the exchange to create a 256 bit session key. This class precalcs a set of values on its own thread. Whenever the pool has less than the minimum, it fills it up again to the max. There is a delay after each precalculation so that the CPU isn't hosed during startup. These three parameters are controlled by java environmental variables and can be adjusted via: -Dcrypto.dh.precalc.min=40 -Dcrypto.dh.precalc.max=100 -Dcrypto.dh.precalc.delay=60000 (delay is milliseconds) To disable precalculation, set min to 0
Nested Class Summary | |
---|---|
static interface |
DHSessionKeyBuilder.Factory
|
static class |
DHSessionKeyBuilder.InvalidPublicParameterException
|
static class |
DHSessionKeyBuilder.PrecalcRunner
|
Constructor Summary | |
---|---|
DHSessionKeyBuilder()
Create a new public/private value pair for the DH exchange. |
|
DHSessionKeyBuilder(RandomSource random)
Create a new public/private value pair for the DH exchange. |
Method Summary | |
---|---|
ByteArray |
getExtraBytes()
Retrieve the extra bytes beyond the session key resulting from the DH exchange. |
BigInteger |
getMyPublicValue()
Retrieve the public value used by the local participant in the DH exchange, |
byte[] |
getMyPublicValueBytes()
Return a 256 byte representation of our public key, with leading 0s if necessary. |
BigInteger |
getPeerPublicValue()
|
byte[] |
getPeerPublicValueBytes()
Return a 256 byte representation of his public key, with leading 0s if necessary. |
SessionKey |
getSessionKey()
Retrieve the session key, calculating it if necessary (and if possible). |
void |
setPeerPublicValue(BigInteger peerVal)
Specify the value given by the peer for use in the session key negotiation |
void |
setPeerPublicValue(byte[] val)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
DHSessionKeyBuilder()
DHSessionKeyBuilder(RandomSource random)
Method Detail |
---|
public BigInteger getMyPublicValue()
public byte[] getMyPublicValueBytes()
public void setPeerPublicValue(BigInteger peerVal) throws DHSessionKeyBuilder.InvalidPublicParameterException
IllegalStateException
- if already set
DHSessionKeyBuilder.InvalidPublicParameterException
public void setPeerPublicValue(byte[] val) throws DHSessionKeyBuilder.InvalidPublicParameterException
val
- 256 bytes
DHSessionKeyBuilder.InvalidPublicParameterException
public BigInteger getPeerPublicValue()
public byte[] getPeerPublicValueBytes()
public SessionKey getSessionKey()
public ByteArray getExtraBytes()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |