public class RatchetSKM extends net.i2p.crypto.SessionKeyManager implements SessionTagListener
| Modifier and Type | Field and Description |
|---|---|
protected RouterContext |
_context |
(package private) static long |
SESSION_LIFETIME_MAX_MS
Keep unused inbound session tags around for this long (a few minutes longer than
session tags are used on the outbound side so that no reasonable network lag
can cause failed decrypts)
This is also the max idle time for an outbound session.
|
(package private) static long |
SESSION_PENDING_DURATION_MS |
(package private) static long |
SESSION_TAG_DURATION_MS
Let outbound session tags sit around for this long before expiring them.
|
| Constructor and Description |
|---|
RatchetSKM(RouterContext context)
For the router SKM only.
|
RatchetSKM(RouterContext context,
net.i2p.data.Destination dest)
The session key manager is constructed and accessed through the
client manager.
|
| Modifier and Type | Method and Description |
|---|---|
(package private) void |
ackRequested(net.i2p.data.PublicKey target,
int id,
int n) |
boolean |
addTag(RatchetSessionTag tag,
RatchetTagSet ts)
Map the tag to this tagset.
|
RatchetEntry |
consumeNextAvailableTag(net.i2p.data.PublicKey target)
Outbound.
|
net.i2p.data.SessionTag |
consumeNextAvailableTag(net.i2p.data.PublicKey target,
net.i2p.data.SessionKey key) |
SessionKeyAndNonce |
consumeTag(RatchetSessionTag tag)
Inbound.
|
net.i2p.data.SessionKey |
consumeTag(net.i2p.data.SessionTag tag) |
(package private) boolean |
createSession(net.i2p.data.PublicKey target,
net.i2p.data.Destination d,
HandshakeState state,
ReplyCallback callback)
Inbound or outbound.
|
void |
createSession(net.i2p.data.PublicKey target,
net.i2p.data.SessionKey key) |
void |
expireTag(RatchetSessionTag tag,
RatchetTagSet ts)
Remove the tag associated with this tagset.
|
void |
failTags(net.i2p.data.PublicKey target)
Deprecated.
unused and rather drastic
|
void |
failTags(net.i2p.data.PublicKey target,
net.i2p.data.SessionKey key,
net.i2p.crypto.TagSetHandle ts) |
int |
getAvailableTags(net.i2p.data.PublicKey target,
net.i2p.data.SessionKey key)
Determine (approximately) how many available session tags for the current target
have been confirmed and are available
|
long |
getAvailableTimeLeft(net.i2p.data.PublicKey target,
net.i2p.data.SessionKey key)
Determine how long the available tags will be available for before expiring, in
milliseconds
|
net.i2p.data.SessionKey |
getCurrentKey(net.i2p.data.PublicKey target) |
net.i2p.data.SessionKey |
getCurrentOrNewKey(net.i2p.data.PublicKey target) |
net.i2p.data.Destination |
getDestination() |
(package private) net.i2p.data.Destination |
getDestination(net.i2p.data.PublicKey target) |
int |
getLowThreshold() |
int |
getTagsToSend()
How many to send, IF we need to.
|
(package private) boolean |
isDuplicate(net.i2p.data.PublicKey pk) |
(package private) void |
nextKeyReceived(net.i2p.data.PublicKey target,
NextSessionKey key) |
(package private) void |
receivedACK(net.i2p.data.PublicKey target,
int id,
int n) |
(package private) void |
registerCallback(net.i2p.data.PublicKey target,
int id,
int n,
ReplyCallback callback) |
(package private) boolean |
registerTimer(net.i2p.data.PublicKey target,
net.i2p.data.Destination d,
net.i2p.util.SimpleTimer2.TimedEvent timer)
Side effect - binds this session to the supplied destination.
|
void |
renderStatusHTML(Writer out) |
boolean |
shouldSendTags(net.i2p.data.PublicKey target,
net.i2p.data.SessionKey key,
int lowThreshold) |
void |
shutdown()
Cannot be restarted
|
void |
tagsAcked(net.i2p.data.PublicKey target,
net.i2p.data.SessionKey key,
net.i2p.crypto.TagSetHandle ts) |
net.i2p.crypto.TagSetHandle |
tagsDelivered(net.i2p.data.PublicKey target,
net.i2p.data.SessionKey key,
Set<net.i2p.data.SessionTag> sessionTags) |
void |
tagsReceived(net.i2p.data.SessionKey key,
RatchetSessionTag tag,
long expire)
One time session
|
void |
tagsReceived(net.i2p.data.SessionKey key,
Set<net.i2p.data.SessionTag> sessionTags) |
void |
tagsReceived(net.i2p.data.SessionKey key,
Set<net.i2p.data.SessionTag> sessionTags,
long expire) |
(package private) boolean |
updateSession(net.i2p.data.PublicKey target,
HandshakeState oldState,
HandshakeState state,
ReplyCallback callback,
SplitKeys split)
Inbound or outbound.
|
protected final RouterContext _context
static final long SESSION_TAG_DURATION_MS
static final long SESSION_LIFETIME_MAX_MS
static final long SESSION_PENDING_DURATION_MS
public RatchetSKM(RouterContext context)
public RatchetSKM(RouterContext context, net.i2p.data.Destination dest)
dest - null for router's SKM onlypublic void shutdown()
shutdown in class net.i2p.crypto.SessionKeyManagerpublic net.i2p.data.Destination getDestination()
public net.i2p.data.SessionKey getCurrentKey(net.i2p.data.PublicKey target)
getCurrentKey in class net.i2p.crypto.SessionKeyManagerUnsupportedOperationException - alwayspublic net.i2p.data.SessionKey getCurrentOrNewKey(net.i2p.data.PublicKey target)
getCurrentOrNewKey in class net.i2p.crypto.SessionKeyManagerUnsupportedOperationException - alwayspublic void createSession(net.i2p.data.PublicKey target,
net.i2p.data.SessionKey key)
createSession in class net.i2p.crypto.SessionKeyManagerUnsupportedOperationException - alwaysboolean isDuplicate(net.i2p.data.PublicKey pk)
boolean createSession(net.i2p.data.PublicKey target,
net.i2p.data.Destination d,
HandshakeState state,
ReplyCallback callback)
d - null if unknowncallback - null for inbound, may be null for outboundboolean updateSession(net.i2p.data.PublicKey target,
HandshakeState oldState,
HandshakeState state,
ReplyCallback callback,
SplitKeys split)
oldState - null for inbound, pre-clone for outboundvoid nextKeyReceived(net.i2p.data.PublicKey target,
NextSessionKey key)
boolean registerTimer(net.i2p.data.PublicKey target,
net.i2p.data.Destination d,
net.i2p.util.SimpleTimer2.TimedEvent timer)
d - the far-end Destination for this PublicKey if known, or nullnet.i2p.data.Destination getDestination(net.i2p.data.PublicKey target)
public net.i2p.data.SessionTag consumeNextAvailableTag(net.i2p.data.PublicKey target,
net.i2p.data.SessionKey key)
consumeNextAvailableTag in class net.i2p.crypto.SessionKeyManagerUnsupportedOperationException - alwayspublic RatchetEntry consumeNextAvailableTag(net.i2p.data.PublicKey target)
public int getTagsToSend()
getTagsToSend in class net.i2p.crypto.SessionKeyManagerpublic int getLowThreshold()
getLowThreshold in class net.i2p.crypto.SessionKeyManagerpublic boolean shouldSendTags(net.i2p.data.PublicKey target,
net.i2p.data.SessionKey key,
int lowThreshold)
shouldSendTags in class net.i2p.crypto.SessionKeyManagerpublic int getAvailableTags(net.i2p.data.PublicKey target,
net.i2p.data.SessionKey key)
getAvailableTags in class net.i2p.crypto.SessionKeyManagerpublic long getAvailableTimeLeft(net.i2p.data.PublicKey target,
net.i2p.data.SessionKey key)
getAvailableTimeLeft in class net.i2p.crypto.SessionKeyManagerpublic net.i2p.crypto.TagSetHandle tagsDelivered(net.i2p.data.PublicKey target,
net.i2p.data.SessionKey key,
Set<net.i2p.data.SessionTag> sessionTags)
tagsDelivered in class net.i2p.crypto.SessionKeyManagerUnsupportedOperationException - always@Deprecated public void failTags(net.i2p.data.PublicKey target)
failTags in class net.i2p.crypto.SessionKeyManagerUnsupportedOperationException - alwayspublic void failTags(net.i2p.data.PublicKey target,
net.i2p.data.SessionKey key,
net.i2p.crypto.TagSetHandle ts)
failTags in class net.i2p.crypto.SessionKeyManagerUnsupportedOperationException - alwayspublic void tagsAcked(net.i2p.data.PublicKey target,
net.i2p.data.SessionKey key,
net.i2p.crypto.TagSetHandle ts)
tagsAcked in class net.i2p.crypto.SessionKeyManagerUnsupportedOperationException - alwayspublic void tagsReceived(net.i2p.data.SessionKey key,
Set<net.i2p.data.SessionTag> sessionTags)
tagsReceived in class net.i2p.crypto.SessionKeyManagerUnsupportedOperationException - alwayspublic void tagsReceived(net.i2p.data.SessionKey key,
Set<net.i2p.data.SessionTag> sessionTags,
long expire)
tagsReceived in class net.i2p.crypto.SessionKeyManagerUnsupportedOperationException - alwayspublic void tagsReceived(net.i2p.data.SessionKey key,
RatchetSessionTag tag,
long expire)
expire - time from nowpublic net.i2p.data.SessionKey consumeTag(net.i2p.data.SessionTag tag)
consumeTag in class net.i2p.crypto.SessionKeyManagerUnsupportedOperationException - alwayspublic SessionKeyAndNonce consumeTag(RatchetSessionTag tag)
public boolean addTag(RatchetSessionTag tag, RatchetTagSet ts)
addTag in interface SessionTagListenerpublic void expireTag(RatchetSessionTag tag, RatchetTagSet ts)
expireTag in interface SessionTagListenervoid registerCallback(net.i2p.data.PublicKey target,
int id,
int n,
ReplyCallback callback)
void receivedACK(net.i2p.data.PublicKey target,
int id,
int n)
void ackRequested(net.i2p.data.PublicKey target,
int id,
int n)
public void renderStatusHTML(Writer out) throws IOException
renderStatusHTML in class net.i2p.crypto.SessionKeyManagerIOException