Package net.i2p.router.crypto.ratchet
Class MuxedSKM
- java.lang.Object
-
- net.i2p.crypto.SessionKeyManager
-
- net.i2p.router.crypto.ratchet.MuxedSKM
-
public class MuxedSKM extends SessionKeyManager
Both.- Since:
- 0.9.44
-
-
Constructor Summary
Constructors Constructor Description MuxedSKM(TransientSessionKeyManager elg, RatchetSKM ec)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RatchetEntry
consumeNextAvailableTag(PublicKey target)
EC onlySessionTag
consumeNextAvailableTag(PublicKey target, SessionKey key)
ElG onlySessionKey
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)
ElG onlyvoid
createSession(PublicKey target, SessionKey key)
ElG onlyvoid
failTags(PublicKey target, SessionKey key, TagSetHandle ts)
ElG onlyint
getAvailableTags(PublicKey target, SessionKey key)
Determine (approximately) how many available session tags for the current target have been confirmed and are availablelong
getAvailableTimeLeft(PublicKey target, SessionKey key)
Determine how long the available tags will be available for before expiring, in millisecondsSessionKey
getCurrentKey(PublicKey target)
ElG onlySessionKey
getCurrentOrNewKey(PublicKey target)
ElG onlyRatchetSKM
getECSKM()
TransientSessionKeyManager
getElgSKM()
int
getLowThreshold()
int
getTagsToSend()
How many to send, IF we need to.(package private) boolean
preferRatchet()
Should we try the Ratchet slow decrypt before ElG slow decrypt? Adaptive test based on previous mix of traffic for this SKM, as reported by reportDecryptResult().void
renderStatusHTML(Writer out)
(package private) void
reportDecryptResult(boolean isRatchet, boolean success)
Report the result of a slow decrypt attempt.boolean
shouldSendTags(PublicKey target, SessionKey key)
ElG onlyboolean
shouldSendTags(PublicKey target, SessionKey key, int lowThreshold)
ElG onlyvoid
shutdown()
Called when the system is closing down, instructing the session key manager to take whatever precautions are necessary (saving state, etc)void
tagsAcked(PublicKey target, SessionKey key, TagSetHandle ts)
ElG onlyTagSetHandle
tagsDelivered(PublicKey target, SessionKey key, Set<SessionTag> sessionTags)
ElG onlyvoid
tagsReceived(SessionKey key, Set<SessionTag> sessionTags)
ElG onlyvoid
tagsReceived(SessionKey key, Set<SessionTag> sessionTags, long expire)
ElG onlyvoid
tagsReceived(SessionKey key, RatchetSessionTag tag, long expire)
EC only One time session-
Methods inherited from class net.i2p.crypto.SessionKeyManager
failTags
-
-
-
-
Constructor Detail
-
MuxedSKM
public MuxedSKM(TransientSessionKeyManager elg, RatchetSKM ec)
-
-
Method Detail
-
getElgSKM
public TransientSessionKeyManager getElgSKM()
-
getECSKM
public RatchetSKM getECSKM()
-
preferRatchet
boolean preferRatchet()
Should we try the Ratchet slow decrypt before ElG slow decrypt? Adaptive test based on previous mix of traffic for this SKM, as reported by reportDecryptResult().- Since:
- 0.9.46
-
reportDecryptResult
void reportDecryptResult(boolean isRatchet, boolean success)
Report the result of a slow decrypt attempt.- Parameters:
isRatchet
- true for EC, false for ElGsuccess
- true for successful decrypt- Since:
- 0.9.46
-
getCurrentKey
public SessionKey getCurrentKey(PublicKey target)
ElG only- Overrides:
getCurrentKey
in classSessionKeyManager
-
getCurrentOrNewKey
public SessionKey getCurrentOrNewKey(PublicKey target)
ElG only- Overrides:
getCurrentOrNewKey
in classSessionKeyManager
- Returns:
- non-null
-
createSession
public void createSession(PublicKey target, SessionKey key)
ElG only- Overrides:
createSession
in classSessionKeyManager
-
createSession
public SessionKey createSession(PublicKey target)
ElG only- Overrides:
createSession
in classSessionKeyManager
-
consumeNextAvailableTag
public SessionTag consumeNextAvailableTag(PublicKey target, SessionKey key)
ElG only- Overrides:
consumeNextAvailableTag
in classSessionKeyManager
-
consumeNextAvailableTag
public RatchetEntry consumeNextAvailableTag(PublicKey target)
EC only
-
getTagsToSend
public int getTagsToSend()
Description copied from class:SessionKeyManager
How many to send, IF we need to.- Overrides:
getTagsToSend
in classSessionKeyManager
-
getLowThreshold
public int getLowThreshold()
- Overrides:
getLowThreshold
in classSessionKeyManager
-
shouldSendTags
public boolean shouldSendTags(PublicKey target, SessionKey key)
ElG only- Overrides:
shouldSendTags
in classSessionKeyManager
- Returns:
- true if we have less than the threshold or what we have is about to expire
-
shouldSendTags
public boolean shouldSendTags(PublicKey target, SessionKey key, int lowThreshold)
ElG only- Overrides:
shouldSendTags
in classSessionKeyManager
- Returns:
- true if we have less than the threshold or what we have is about to expire
-
getAvailableTags
public int getAvailableTags(PublicKey target, SessionKey key)
Description copied from class:SessionKeyManager
Determine (approximately) how many available session tags for the current target have been confirmed and are available- Overrides:
getAvailableTags
in classSessionKeyManager
-
getAvailableTimeLeft
public long getAvailableTimeLeft(PublicKey target, SessionKey key)
Description copied from class:SessionKeyManager
Determine how long the available tags will be available for before expiring, in milliseconds- Overrides:
getAvailableTimeLeft
in classSessionKeyManager
-
tagsDelivered
public TagSetHandle tagsDelivered(PublicKey target, SessionKey key, Set<SessionTag> sessionTags)
ElG only- Overrides:
tagsDelivered
in classSessionKeyManager
-
tagsReceived
public void tagsReceived(SessionKey key, Set<SessionTag> sessionTags)
ElG only- Overrides:
tagsReceived
in classSessionKeyManager
-
tagsReceived
public void tagsReceived(SessionKey key, Set<SessionTag> sessionTags, long expire)
ElG only- Overrides:
tagsReceived
in classSessionKeyManager
sessionTags
- modifiable; NOT copiedexpire
- time from now
-
tagsReceived
public void tagsReceived(SessionKey key, RatchetSessionTag tag, long expire)
EC only One time session- Parameters:
expire
- time from now- Since:
- 0.9.51
-
consumeTag
public SessionKey consumeTag(SessionTag tag)
Description copied from class:SessionKeyManager
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(...)). returns null if no session key matches- Overrides:
consumeTag
in classSessionKeyManager
-
shutdown
public void shutdown()
Description copied from class:SessionKeyManager
Called when the system is closing down, instructing the session key manager to take whatever precautions are necessary (saving state, etc)- Overrides:
shutdown
in classSessionKeyManager
-
renderStatusHTML
public void renderStatusHTML(Writer out) throws IOException
- Overrides:
renderStatusHTML
in classSessionKeyManager
- Throws:
IOException
-
failTags
public void failTags(PublicKey target, SessionKey key, TagSetHandle ts)
ElG only- Overrides:
failTags
in classSessionKeyManager
-
tagsAcked
public void tagsAcked(PublicKey target, SessionKey key, TagSetHandle ts)
ElG only- Overrides:
tagsAcked
in classSessionKeyManager
-
-