Changeset 9116394 for router


Ignore:
Timestamp:
Jan 4, 2017 2:29:37 PM (4 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
6ad4cb0
Parents:
e16cf2c
Message:

Router: Replace random tunnel keys when rekeying

Location:
router/java/src/net/i2p/router
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/Router.java

    re16cf2c r9116394  
    115115    /** deprecated, use gracefulShutdownInProgress() */
    116116    private final static String PROP_SHUTDOWN_IN_PROGRESS = "__shutdownInProgress";
    117     private static final String PROP_IB_RANDOM_KEY = TunnelPoolSettings.PREFIX_INBOUND_EXPLORATORY + TunnelPoolSettings.PROP_RANDOM_KEY;
    118     private static final String PROP_OB_RANDOM_KEY = TunnelPoolSettings.PREFIX_OUTBOUND_EXPLORATORY + TunnelPoolSettings.PROP_RANDOM_KEY;
     117    public static final String PROP_IB_RANDOM_KEY = TunnelPoolSettings.PREFIX_INBOUND_EXPLORATORY + TunnelPoolSettings.PROP_RANDOM_KEY;
     118    public static final String PROP_OB_RANDOM_KEY = TunnelPoolSettings.PREFIX_OUTBOUND_EXPLORATORY + TunnelPoolSettings.PROP_RANDOM_KEY;
    119119    private final static String DNS_CACHE_TIME = "" + (5*60);
    120120    private static final String EVENTLOG = "eventlog.txt";
     
    622622        synchronized(_configFileLock) {
    623623            // persistent key for peer ordering since 0.9.17
     624            // These will be replaced in CreateRouterInfoJob if we rekey
    624625            if (!_config.containsKey(PROP_IB_RANDOM_KEY)) {
    625626                byte rk[] = new byte[32];
  • router/java/src/net/i2p/router/startup/CreateRouterInfoJob.java

    re16cf2c r9116394  
    1414import java.io.OutputStream;
    1515import java.security.GeneralSecurityException;
     16import java.util.HashMap;
     17import java.util.Map;
    1618import java.util.Properties;
    1719
    1820import net.i2p.crypto.SigType;
     21import net.i2p.data.Base64;
    1922import net.i2p.data.Certificate;
    2023import net.i2p.data.DataFormatException;
     
    145148            pkf.write();
    146149           
     150            // set or overwrite old random keys
     151            Map<String, String> map = new HashMap<String, String>(2);
     152            byte rk[] = new byte[32];
     153            getContext().random().nextBytes(rk);
     154            map.put(Router.PROP_IB_RANDOM_KEY, Base64.encode(rk));
     155            getContext().random().nextBytes(rk);
     156            map.put(Router.PROP_OB_RANDOM_KEY, Base64.encode(rk));
     157            getContext().router().saveConfig(map, null);
     158
    147159            getContext().keyManager().setKeys(pubkey, privkey, signingPubKey, signingPrivKey);
    148160           
Note: See TracChangeset for help on using the changeset viewer.