forked from I2P_Developers/i2p.i2p
Crypto: Move TransientSessionKeyManager from core to router.
I2PAppContext will return the dummy SessionKeyManager which is sufficient for non-tag uses (e.g. Bote). Client use of end-to-end encryption using SessionTags was disabled in release 0.6, 2005-07-27.
This commit is contained in:
@ -22,7 +22,6 @@ import net.i2p.crypto.HMACGenerator;
|
|||||||
import net.i2p.crypto.KeyGenerator;
|
import net.i2p.crypto.KeyGenerator;
|
||||||
import net.i2p.crypto.SHA256Generator;
|
import net.i2p.crypto.SHA256Generator;
|
||||||
import net.i2p.crypto.SessionKeyManager;
|
import net.i2p.crypto.SessionKeyManager;
|
||||||
import net.i2p.crypto.TransientSessionKeyManager;
|
|
||||||
import net.i2p.data.Base64;
|
import net.i2p.data.Base64;
|
||||||
import net.i2p.data.RoutingKeyGenerator;
|
import net.i2p.data.RoutingKeyGenerator;
|
||||||
import net.i2p.internal.InternalClientManager;
|
import net.i2p.internal.InternalClientManager;
|
||||||
@ -76,7 +75,7 @@ public class I2PAppContext {
|
|||||||
protected final I2PProperties _overrideProps;
|
protected final I2PProperties _overrideProps;
|
||||||
|
|
||||||
private StatManager _statManager;
|
private StatManager _statManager;
|
||||||
private SessionKeyManager _sessionKeyManager;
|
protected SessionKeyManager _sessionKeyManager;
|
||||||
private NamingService _namingService;
|
private NamingService _namingService;
|
||||||
private ElGamalEngine _elGamalEngine;
|
private ElGamalEngine _elGamalEngine;
|
||||||
private ElGamalAESEngine _elGamalAESEngine;
|
private ElGamalAESEngine _elGamalAESEngine;
|
||||||
@ -96,7 +95,7 @@ public class I2PAppContext {
|
|||||||
private SimpleTimer2 _simpleTimer2;
|
private SimpleTimer2 _simpleTimer2;
|
||||||
private final PortMapper _portMapper;
|
private final PortMapper _portMapper;
|
||||||
private volatile boolean _statManagerInitialized;
|
private volatile boolean _statManagerInitialized;
|
||||||
private volatile boolean _sessionKeyManagerInitialized;
|
protected volatile boolean _sessionKeyManagerInitialized;
|
||||||
private volatile boolean _namingServiceInitialized;
|
private volatile boolean _namingServiceInitialized;
|
||||||
private volatile boolean _elGamalEngineInitialized;
|
private volatile boolean _elGamalEngineInitialized;
|
||||||
private volatile boolean _elGamalAESEngineInitialized;
|
private volatile boolean _elGamalAESEngineInitialized;
|
||||||
@ -599,6 +598,9 @@ public class I2PAppContext {
|
|||||||
* For client crypto within the router,
|
* For client crypto within the router,
|
||||||
* use RouterContext.clientManager.getClientSessionKeyManager(dest)
|
* use RouterContext.clientManager.getClientSessionKeyManager(dest)
|
||||||
*
|
*
|
||||||
|
* As of 0.9.15, this returns a dummy SessionKeyManager in I2PAppContext.
|
||||||
|
* The dummy SKM does NOT handle session tags.
|
||||||
|
* Overridden in RouterContext to return the full TransientSessionKeyManager.
|
||||||
*/
|
*/
|
||||||
public SessionKeyManager sessionKeyManager() {
|
public SessionKeyManager sessionKeyManager() {
|
||||||
if (!_sessionKeyManagerInitialized)
|
if (!_sessionKeyManagerInitialized)
|
||||||
@ -606,11 +608,11 @@ public class I2PAppContext {
|
|||||||
return _sessionKeyManager;
|
return _sessionKeyManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeSessionKeyManager() {
|
protected void initializeSessionKeyManager() {
|
||||||
synchronized (_lock3) {
|
synchronized (_lock3) {
|
||||||
if (_sessionKeyManager == null)
|
if (_sessionKeyManager == null)
|
||||||
//_sessionKeyManager = new PersistentSessionKeyManager(this);
|
//_sessionKeyManager = new PersistentSessionKeyManager(this);
|
||||||
_sessionKeyManager = new TransientSessionKeyManager(this);
|
_sessionKeyManager = new SessionKeyManager(this);
|
||||||
_sessionKeyManagerInitialized = true;
|
_sessionKeyManagerInitialized = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ import net.i2p.data.Hash;
|
|||||||
import net.i2p.data.RouterInfo;
|
import net.i2p.data.RouterInfo;
|
||||||
import net.i2p.internal.InternalClientManager;
|
import net.i2p.internal.InternalClientManager;
|
||||||
import net.i2p.router.client.ClientManagerFacadeImpl;
|
import net.i2p.router.client.ClientManagerFacadeImpl;
|
||||||
|
import net.i2p.router.crypto.TransientSessionKeyManager;
|
||||||
import net.i2p.router.dummy.*;
|
import net.i2p.router.dummy.*;
|
||||||
import net.i2p.router.networkdb.kademlia.FloodfillNetworkDatabaseFacade;
|
import net.i2p.router.networkdb.kademlia.FloodfillNetworkDatabaseFacade;
|
||||||
import net.i2p.router.peermanager.PeerManagerFacadeImpl;
|
import net.i2p.router.peermanager.PeerManagerFacadeImpl;
|
||||||
@ -67,7 +68,7 @@ public class RouterContext extends I2PAppContext {
|
|||||||
private final Set<Runnable> _finalShutdownTasks;
|
private final Set<Runnable> _finalShutdownTasks;
|
||||||
// split up big lock on this to avoid deadlocks
|
// split up big lock on this to avoid deadlocks
|
||||||
private volatile boolean _initialized;
|
private volatile boolean _initialized;
|
||||||
private final Object _lock1 = new Object(), _lock2 = new Object();
|
private final Object _lock1 = new Object(), _lock2 = new Object(), _lock3 = new Object();
|
||||||
|
|
||||||
private static final List<RouterContext> _contexts = new CopyOnWriteArrayList<RouterContext>();
|
private static final List<RouterContext> _contexts = new CopyOnWriteArrayList<RouterContext>();
|
||||||
|
|
||||||
@ -565,4 +566,20 @@ public class RouterContext extends I2PAppContext {
|
|||||||
public RouterAppManager routerAppManager() {
|
public RouterAppManager routerAppManager() {
|
||||||
return _appManager;
|
return _appManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* As of 0.9.15, this returns a dummy SessionKeyManager in I2PAppContext.
|
||||||
|
* Overridden in RouterContext to return the full TransientSessionKeyManager.
|
||||||
|
*
|
||||||
|
* @since 0.9.15
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void initializeSessionKeyManager() {
|
||||||
|
synchronized (_lock3) {
|
||||||
|
if (_sessionKeyManager == null)
|
||||||
|
//_sessionKeyManager = new PersistentSessionKeyManager(this);
|
||||||
|
_sessionKeyManager = new TransientSessionKeyManager(this);
|
||||||
|
_sessionKeyManagerInitialized = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
|
|
||||||
import net.i2p.client.I2PClient;
|
import net.i2p.client.I2PClient;
|
||||||
import net.i2p.crypto.SessionKeyManager;
|
import net.i2p.crypto.SessionKeyManager;
|
||||||
import net.i2p.crypto.TransientSessionKeyManager;
|
|
||||||
import net.i2p.data.Destination;
|
import net.i2p.data.Destination;
|
||||||
import net.i2p.data.Hash;
|
import net.i2p.data.Hash;
|
||||||
import net.i2p.data.LeaseSet;
|
import net.i2p.data.LeaseSet;
|
||||||
@ -43,6 +42,7 @@ import net.i2p.data.i2cp.SessionId;
|
|||||||
import net.i2p.router.Job;
|
import net.i2p.router.Job;
|
||||||
import net.i2p.router.JobImpl;
|
import net.i2p.router.JobImpl;
|
||||||
import net.i2p.router.RouterContext;
|
import net.i2p.router.RouterContext;
|
||||||
|
import net.i2p.router.crypto.TransientSessionKeyManager;
|
||||||
import net.i2p.util.ConcurrentHashSet;
|
import net.i2p.util.ConcurrentHashSet;
|
||||||
import net.i2p.util.I2PThread;
|
import net.i2p.util.I2PThread;
|
||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package net.i2p.crypto;
|
package net.i2p.router.crypto;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* free (adj.): unencumbered; not under the control of others
|
* free (adj.): unencumbered; not under the control of others
|
||||||
@ -25,6 +25,8 @@ import java.util.TreeSet;
|
|||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import net.i2p.I2PAppContext;
|
import net.i2p.I2PAppContext;
|
||||||
|
import net.i2p.crypto.SessionKeyManager;
|
||||||
|
import net.i2p.crypto.TagSetHandle;
|
||||||
import net.i2p.data.DataHelper;
|
import net.i2p.data.DataHelper;
|
||||||
import net.i2p.data.PublicKey;
|
import net.i2p.data.PublicKey;
|
||||||
import net.i2p.data.SessionKey;
|
import net.i2p.data.SessionKey;
|
7
router/java/src/net/i2p/router/crypto/package.html
Normal file
7
router/java/src/net/i2p/router/crypto/package.html
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
Classes formerly in net.i2p.crypto but moved here as they are only used by the router.
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
Reference in New Issue
Block a user