|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.crypto.SessionKeyManager
public class SessionKeyManager
Manage the session keys and session tags used for encryption and decryption. This base implementation simply ignores sessions and acts as if everything is unknown (and hence always forces a full ElGamal encryption for each message). A more intelligent subclass should manage and persist keys and tags.
Constructor Summary | |
---|---|
protected |
SessionKeyManager(I2PAppContext context)
session key managers must be created through an app context |
Method Summary | |
---|---|
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(...)). |
SessionKey |
createSession(PublicKey target)
Generate a new session key and associate it with the specified target. |
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. |
void |
shutdown()
Called when the system is closing down, instructing the session key manager to take whatever precautions are necessary (saving state, etc) |
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 java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected SessionKeyManager(I2PAppContext context)
Method Detail |
---|
public SessionKey getCurrentKey(PublicKey target)
public void createSession(PublicKey target, SessionKey key)
public SessionKey createSession(PublicKey target)
public SessionTag consumeNextAvailableTag(PublicKey target, SessionKey key)
public int getAvailableTags(PublicKey target, SessionKey key)
public long getAvailableTimeLeft(PublicKey target, SessionKey key)
public void tagsDelivered(PublicKey target, SessionKey key, java.util.Set sessionTags)
public void failTags(PublicKey target)
public void tagsReceived(SessionKey key, java.util.Set sessionTags)
public SessionKey consumeTag(SessionTag tag)
public void shutdown()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |