logging and javadoc tweaks
This commit is contained in:
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
@ -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()))
|
||||
|
Reference in New Issue
Block a user