* Router: Add a keyring for decrypting leases

* Routerconsole: Add configkeyring.jsp
This commit is contained in:
zzz
2009-01-20 17:12:24 +00:00
parent 807f0665b1
commit 8d891b99d1
8 changed files with 314 additions and 0 deletions

View File

@@ -24,6 +24,7 @@ import net.i2p.data.RoutingKeyGenerator;
import net.i2p.stat.StatManager;
import net.i2p.util.Clock;
import net.i2p.util.FortunaRandomSource;
import net.i2p.util.KeyRing;
import net.i2p.util.LogManager;
import net.i2p.util.PooledRandomSource;
import net.i2p.util.RandomSource;
@@ -75,6 +76,7 @@ public class I2PAppContext {
private RoutingKeyGenerator _routingKeyGenerator;
private RandomSource _random;
private KeyGenerator _keyGenerator;
protected KeyRing _keyRing; // overridden in RouterContext
private volatile boolean _statManagerInitialized;
private volatile boolean _sessionKeyManagerInitialized;
private volatile boolean _namingServiceInitialized;
@@ -91,6 +93,7 @@ public class I2PAppContext {
private volatile boolean _routingKeyGeneratorInitialized;
private volatile boolean _randomInitialized;
private volatile boolean _keyGeneratorInitialized;
protected volatile boolean _keyRingInitialized; // used in RouterContext
/**
@@ -141,12 +144,14 @@ public class I2PAppContext {
_elGamalEngine = null;
_elGamalAESEngine = null;
_logManager = null;
_keyRing = null;
_statManagerInitialized = false;
_sessionKeyManagerInitialized = false;
_namingServiceInitialized = false;
_elGamalEngineInitialized = false;
_elGamalAESEngineInitialized = false;
_logManagerInitialized = false;
_keyRingInitialized = false;
}
/**
@@ -512,6 +517,23 @@ public class I2PAppContext {
}
}
/**
* Basic hash map
*/
public KeyRing keyRing() {
if (!_keyRingInitialized)
initializeKeyRing();
return _keyRing;
}
protected void initializeKeyRing() {
synchronized (this) {
if (_keyRing == null)
_keyRing = new KeyRing();
_keyRingInitialized = true;
}
}
/**
* [insert snarky comment here]
*

View File

@@ -0,0 +1,20 @@
package net.i2p.util;
import java.io.IOException;
import java.io.Writer;
import java.util.concurrent.ConcurrentHashMap;
import net.i2p.data.Hash;
import net.i2p.data.SessionKey;
/**
* simple
*/
public class KeyRing extends ConcurrentHashMap<Hash, SessionKey> {
public KeyRing() {
super(0);
}
public void renderStatusHTML(Writer out) throws IOException {}
}