Changeset 90e6458 for router


Ignore:
Timestamp:
May 26, 2019 12:09:28 PM (12 months ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
73b00eb
Parents:
c2e2cc2
Message:

I2CP: Add per-client auth to generated leaseset
Set key on router side before verifying

File:
1 edited

Legend:

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

    rc2e2cc2 r90e6458  
    559559                _runner.disconnectClient(re.toString());
    560560                return;
     561            }
     562            // per-client auth
     563            // we have to do this before verifySignature()
     564            String pk = cfg.getOptions().getProperty("i2cp.leaseSetPrivKey");
     565            if (pk != null) {
     566                byte[] priv = Base64.decode(pk);
     567                PrivateKey privkey = new PrivateKey(EncType.ECIES_X25519, priv);
     568                EncryptedLeaseSet encls = (EncryptedLeaseSet) ls;
     569                encls.setClientPrivateKey(privkey);
    561570            }
    562571            // we have to do this before checking encryption keys below
     
    649658                    encls.setSecret(secret);
    650659                }
    651                 // per-client auth
    652                 String pk = cfg.getOptions().getProperty("i2cp.leaseSetPrivKey");
    653                 if (pk != null) {
    654                     byte[] priv = Base64.decode(pk);
    655                     if (priv == null)
    656                         throw new IllegalArgumentException("bad privkey");
    657                     PrivateKey privkey = new PrivateKey(EncType.ECIES_X25519, priv);
    658                     EncryptedLeaseSet encls = (EncryptedLeaseSet) ls;
    659                     encls.setClientPrivateKey(privkey);
    660                 }
    661660            }
    662661            if (_log.shouldDebug())
Note: See TracChangeset for help on using the changeset viewer.