diff --git a/core/java/src/net/i2p/crypto/ElGamalAESEngine.java b/core/java/src/net/i2p/crypto/ElGamalAESEngine.java index 98e9e62cc4134b1c6455830c9394dfae96c3d276..047b0156ef1159210f9495ef9661c6b7c3f07b90 100644 --- a/core/java/src/net/i2p/crypto/ElGamalAESEngine.java +++ b/core/java/src/net/i2p/crypto/ElGamalAESEngine.java @@ -359,8 +359,8 @@ public class ElGamalAESEngine { * @param target public key to which the data should be encrypted. * @param key session key to use during encryption * @param tagsForDelivery session tags to be associated with the key (or newKey if specified), or null - * @param currentTag sessionTag to use, or null if it should use ElG - * @param newKey key to be delivered to the target, with which the tagsForDelivery should be associated + * @param currentTag sessionTag to use, or null if it should use ElG (i.e. new session) + * @param newKey key to be delivered to the target, with which the tagsForDelivery should be associated, or null * @param paddedSize minimum size in bytes of the body after padding it (if less than the * body's real size, no bytes are appended but the body is not truncated) */ @@ -368,12 +368,12 @@ public class ElGamalAESEngine { SessionTag currentTag, SessionKey newKey, long paddedSize) { if (currentTag == null) { if (_log.shouldLog(Log.INFO)) - _log.info("Current tag is null, encrypting as new session", new Exception("encrypt new")); + _log.info("Current tag is null, encrypting as new session"); _context.statManager().updateFrequency("crypto.elGamalAES.encryptNewSession"); return encryptNewSession(data, target, key, tagsForDelivery, newKey, paddedSize); } if (_log.shouldLog(Log.INFO)) - _log.info("Current tag is NOT null, encrypting as existing session", new Exception("encrypt existing")); + _log.info("Current tag is NOT null, encrypting as existing session"); _context.statManager().updateFrequency("crypto.elGamalAES.encryptExistingSession"); byte rv[] = encryptExistingSession(data, target, key, tagsForDelivery, currentTag, newKey, paddedSize); if (_log.shouldLog(Log.DEBUG)) @@ -383,6 +383,7 @@ public class ElGamalAESEngine { /** * Encrypt the data to the target using the given key and deliver the specified tags + * No new session key */ public byte[] encrypt(byte data[], PublicKey target, SessionKey key, Set tagsForDelivery, SessionTag currentTag, long paddedSize) { @@ -391,6 +392,8 @@ public class ElGamalAESEngine { /** * Encrypt the data to the target using the given key and deliver the specified tags + * No new session key + * No current tag (encrypt as new session) */ public byte[] encrypt(byte data[], PublicKey target, SessionKey key, Set tagsForDelivery, long paddedSize) { return encrypt(data, target, key, tagsForDelivery, null, null, paddedSize); @@ -398,6 +401,8 @@ public class ElGamalAESEngine { /** * Encrypt the data to the target using the given key delivering no tags + * No new session key + * No current tag (encrypt as new session) */ public byte[] encrypt(byte data[], PublicKey target, SessionKey key, long paddedSize) { return encrypt(data, target, key, null, null, null, paddedSize); diff --git a/router/java/src/net/i2p/router/networkdb/DatabaseLookupMessageHandler.java b/router/java/src/net/i2p/router/networkdb/DatabaseLookupMessageHandler.java index 84dd56890b3c082ac25a84062eb96cbc2bfbb859..94f16f635a8b19c2d7e4d2c158e8a049a7abbb2c 100644 --- a/router/java/src/net/i2p/router/networkdb/DatabaseLookupMessageHandler.java +++ b/router/java/src/net/i2p/router/networkdb/DatabaseLookupMessageHandler.java @@ -19,7 +19,7 @@ import net.i2p.util.Log; /** * Build a HandleDatabaseLookupMessageJob whenever a DatabaseLookupMessage arrives - * + * Unused - see kademlia/ for replacement */ public class DatabaseLookupMessageHandler implements HandlerJobBuilder { private RouterContext _context; diff --git a/router/java/src/net/i2p/router/networkdb/DatabaseStoreMessageHandler.java b/router/java/src/net/i2p/router/networkdb/DatabaseStoreMessageHandler.java index d64a2ec9aa3ddadc0ec08a74a83c62bbdf65d29e..5a2e6b10130bb47331eddca7b925b0e6d19eea0e 100644 --- a/router/java/src/net/i2p/router/networkdb/DatabaseStoreMessageHandler.java +++ b/router/java/src/net/i2p/router/networkdb/DatabaseStoreMessageHandler.java @@ -18,7 +18,7 @@ import net.i2p.router.RouterContext; /** * Create a HandleDatabaseStoreMessageJob whenever a DatabaseStoreMessage arrives - * + * Unused - see kademlia/ for replacement */ public class DatabaseStoreMessageHandler implements HandlerJobBuilder { private RouterContext _context; diff --git a/router/java/src/net/i2p/router/networkdb/HandleDatabaseLookupMessageJob.java b/router/java/src/net/i2p/router/networkdb/HandleDatabaseLookupMessageJob.java index 8259e69395bea5d69b25c3eb947c5b72f8731e6d..55266f0853db3e2473dacbccb87bfce7bc6c0c0b 100644 --- a/router/java/src/net/i2p/router/networkdb/HandleDatabaseLookupMessageJob.java +++ b/router/java/src/net/i2p/router/networkdb/HandleDatabaseLookupMessageJob.java @@ -33,7 +33,7 @@ import net.i2p.util.Log; /** * Handle a lookup for a key received from a remote peer. Needs to be implemented * to send back replies, etc - * + * Unused directly - see kademlia/ for extension */ public class HandleDatabaseLookupMessageJob extends JobImpl { private Log _log; diff --git a/router/java/src/net/i2p/router/networkdb/HandleDatabaseStoreMessageJob.java b/router/java/src/net/i2p/router/networkdb/HandleDatabaseStoreMessageJob.java index c4a0b9f451af4ecc04515fae490be2ab43d266c4..a61f947a59565ada3f5a83175f02b773f58c8e23 100644 --- a/router/java/src/net/i2p/router/networkdb/HandleDatabaseStoreMessageJob.java +++ b/router/java/src/net/i2p/router/networkdb/HandleDatabaseStoreMessageJob.java @@ -22,7 +22,7 @@ import net.i2p.util.Log; /** * Receive DatabaseStoreMessage data and store it in the local net db - * + * Unused - see kademlia/ for replacement */ public class HandleDatabaseStoreMessageJob extends JobImpl { private Log _log; diff --git a/router/java/src/net/i2p/router/networkdb/kademlia/HandleFloodfillDatabaseStoreMessageJob.java b/router/java/src/net/i2p/router/networkdb/kademlia/HandleFloodfillDatabaseStoreMessageJob.java index 2c3cdbe4efecfe31864b4693281dbff94e238bca..9ad1c5a0a7cc108d473e57bcb6cb6e328b858a15 100644 --- a/router/java/src/net/i2p/router/networkdb/kademlia/HandleFloodfillDatabaseStoreMessageJob.java +++ b/router/java/src/net/i2p/router/networkdb/kademlia/HandleFloodfillDatabaseStoreMessageJob.java @@ -64,6 +64,11 @@ public class HandleFloodfillDatabaseStoreMessageJob extends JobImpl { RouterInfo prevNetDb = null; if (_message.getValueType() == DatabaseStoreMessage.KEY_TYPE_LEASESET) { getContext().statManager().addRateData("netDb.storeLeaseSetHandled", 1, 0); + Hash key = _message.getKey(); + if (_log.shouldLog(Log.INFO)) + _log.info("Handling dbStore of leaseset " + _message); + //_log.info("Handling dbStore of leasset " + key + " with expiration of " + // + new Date(_message.getLeaseSet().getEarliestLeaseDate())); try { // Never store a leaseSet for a local dest received from somebody else. @@ -72,18 +77,18 @@ public class HandleFloodfillDatabaseStoreMessageJob extends JobImpl { // somebody has our keys... // This could happen with multihoming - where it's really important to prevent // storing the other guy's leaseset, it will confuse us badly. - if (getContext().clientManager().isLocal(_message.getKey())) { + if (getContext().clientManager().isLocal(key)) { //getContext().statManager().addRateData("netDb.storeLocalLeaseSetAttempt", 1, 0); // throw rather than return, so that we send the ack below (prevent easy attack) throw new IllegalArgumentException("Peer attempted to store local leaseSet: " + - _message.getKey().toBase64().substring(0, 4)); + key.toBase64().substring(0, 4)); } LeaseSet ls = _message.getLeaseSet(); // mark it as something we received, so we'll answer queries // for it. this flag does NOT get set on entries that we // receive in response to our own lookups. ls.setReceivedAsPublished(true); - LeaseSet match = getContext().netDb().store(_message.getKey(), _message.getLeaseSet()); + LeaseSet match = getContext().netDb().store(key, _message.getLeaseSet()); if ( (match == null) || (match.getEarliestLeaseDate() < _message.getLeaseSet().getEarliestLeaseDate()) ) { wasNew = true; } else { diff --git a/router/java/src/net/i2p/router/tunnel/OutboundTunnelEndpoint.java b/router/java/src/net/i2p/router/tunnel/OutboundTunnelEndpoint.java index 7ba086fdcf2ad524d3f35b729dfe026b0d545073..3e5433499c8ef42bf369a6cd01ec79085100f528 100644 --- a/router/java/src/net/i2p/router/tunnel/OutboundTunnelEndpoint.java +++ b/router/java/src/net/i2p/router/tunnel/OutboundTunnelEndpoint.java @@ -49,7 +49,7 @@ public class OutboundTunnelEndpoint { _log.debug("outbound tunnel " + _config + " received a full message: " + msg + " to be forwarded on to " + (toRouter != null ? toRouter.toBase64().substring(0,4) : "") - + (toTunnel != null ? toTunnel.getTunnelId() + "" : "")); + + (toTunnel != null ? ":" + toTunnel.getTunnelId() : "")); // don't drop it if we are the target if ((!_context.routerHash().equals(toRouter)) && _context.tunnelDispatcher().shouldDropParticipatingMessage("OBEP " + msg.getType(), msg.getMessageSize()))