|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.crypto.SessionKeyManager
net.i2p.crypto.TransientSessionKeyManager
net.i2p.crypto.PersistentSessionKeyManager
Expose the functionality to allow people to write out and read in the session key and session tag information via streams. This implementation does not write anywhere except where its told.
Nested Class Summary | |
(package private) class |
TransientSessionKeyManager.OutboundSession
|
(package private) static class |
TransientSessionKeyManager.TagSet
|
Field Summary | |
protected I2PAppContext |
_context
|
static int |
MAX_INBOUND_SESSION_TAGS
|
static long |
SESSION_LIFETIME_MAX_MS
Keep unused inbound session tags around for up to 12 minutes (2 minutes longer than session tags are used on the outbound side so that no reasonable network lag can cause failed decrypts) |
static long |
SESSION_TAG_DURATION_MS
Let session tags sit around for 10 minutes before expiring them. |
Constructor Summary | |
PersistentSessionKeyManager(I2PAppContext context)
The session key manager should only be constructed and accessed through the application context. |
Method Summary | |
int |
aggressiveExpire()
Aggressively expire inbound tag sets and outbound sessions |
SessionTag |
consumeNextAvailableTag(PublicKey target,
SessionKey key)
Retrieve the next available session tag for identifying the use of the given key when communicating with the target. |
SessionKey |
consumeTag(SessionTag tag)
Determine if we have received a session key associated with the given session tag, and if so, discard it (but keep track for frequent dups) and return the decryption key it was received with (via tagsReceived(...)). |
void |
createSession(PublicKey target,
SessionKey key)
Associate a new session key with the specified target. |
void |
failTags(PublicKey target)
Mark all of the tags delivered to the target up to this point as invalid, since the peer has failed to respond when they should have. |
int |
getAvailableTags(PublicKey target,
SessionKey key)
Determine (approximately) how many available session tags for the current target have been confirmed and are available |
long |
getAvailableTimeLeft(PublicKey target,
SessionKey key)
Determine how long the available tags will be available for before expiring, in milliseconds |
SessionKey |
getCurrentKey(PublicKey target)
Retrieve the session key currently associated with encryption to the target, or null if a new session key should be generated. |
protected java.util.Set |
getInboundTagSets()
TagSet |
protected java.util.Set |
getOutboundSessions()
OutboundSession |
void |
loadState(java.io.InputStream in)
Load the session key data from the given stream |
static void |
main(java.lang.String[] args)
|
java.lang.String |
renderStatusHTML()
|
void |
saveState(java.io.OutputStream out)
Write the session key data to the given stream |
protected void |
setData(java.util.Set inboundTagSets,
java.util.Set outboundSessions)
|
void |
tagsDelivered(PublicKey target,
SessionKey key,
java.util.Set sessionTags)
Take note of the fact that the given sessionTags associated with the key for encryption to the target have definitely been received at the target (aka call this method after receiving an ack to a message delivering them) |
void |
tagsReceived(SessionKey key,
java.util.Set sessionTags)
Accept the given tags and associate them with the given key for decryption |
Methods inherited from class net.i2p.crypto.SessionKeyManager |
createSession, shutdown |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected I2PAppContext _context
public static final long SESSION_TAG_DURATION_MS
public static final long SESSION_LIFETIME_MAX_MS
public static final int MAX_INBOUND_SESSION_TAGS
Constructor Detail |
public PersistentSessionKeyManager(I2PAppContext context)
Method Detail |
public void saveState(java.io.OutputStream out) throws java.io.IOException, DataFormatException
java.io.IOException
DataFormatException
public void loadState(java.io.InputStream in) throws java.io.IOException, DataFormatException
java.io.IOException
DataFormatException
public static void main(java.lang.String[] args)
protected java.util.Set getInboundTagSets()
protected java.util.Set getOutboundSessions()
protected void setData(java.util.Set inboundTagSets, java.util.Set outboundSessions)
public SessionKey getCurrentKey(PublicKey target)
getCurrentKey
in class SessionKeyManager
public void createSession(PublicKey target, SessionKey key)
createSession
in class SessionKeyManager
public SessionTag consumeNextAvailableTag(PublicKey target, SessionKey key)
consumeNextAvailableTag
in class SessionKeyManager
public int getAvailableTags(PublicKey target, SessionKey key)
getAvailableTags
in class SessionKeyManager
public long getAvailableTimeLeft(PublicKey target, SessionKey key)
getAvailableTimeLeft
in class SessionKeyManager
public void tagsDelivered(PublicKey target, SessionKey key, java.util.Set sessionTags)
tagsDelivered
in class SessionKeyManager
public void failTags(PublicKey target)
failTags
in class SessionKeyManager
public void tagsReceived(SessionKey key, java.util.Set sessionTags)
tagsReceived
in class SessionKeyManager
public SessionKey consumeTag(SessionTag tag)
consumeTag
in class SessionKeyManager
public int aggressiveExpire()
public java.lang.String renderStatusHTML()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |