Changeset 176c106


Ignore:
Timestamp:
Aug 26, 2014 8:12:29 PM (6 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
a9802eb6
Parents:
ed4fe56
Message:

I2CP: Catch bad private key

File:
1 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/client/ClientMessageEventListener.java

    red4fe56 r176c106  
    1616import net.i2p.data.Hash;
    1717import net.i2p.data.Payload;
     18import net.i2p.data.PublicKey;
    1819import net.i2p.data.i2cp.BandwidthLimitsMessage;
    1920import net.i2p.data.i2cp.CreateLeaseSetMessage;
     
    382383            !message.getPrivateKey().equals(keys.getDecryptionKey())) {
    383384            // Verify and register crypto keys if new or if changed
    384             // Private crypto key should never change
    385             if (!message.getPrivateKey().toPublic().equals(dest.getPublicKey())) {
     385            // Private crypto key should never change, and if it does,
     386            // one of the checks below will fail
     387            PublicKey pk;
     388            try {
     389                pk = message.getPrivateKey().toPublic();
     390            } catch (IllegalArgumentException iae) {
     391                if (_log.shouldLog(Log.ERROR))
     392                    _log.error("Bad private key in LS");
     393                _runner.disconnectClient("Bad private key in LS");
     394                return;
     395            }
     396            if (!pk.equals(dest.getPublicKey())) {
    386397                if (_log.shouldLog(Log.ERROR))
    387398                    _log.error("Private/public crypto key mismatch in LS");
Note: See TracChangeset for help on using the changeset viewer.