I2CP: Remove revocation private key from CreateLeaseset2 message

Use correct key to sign SessionConfig with offline keys
LeaseSetKeys cleanups
This commit is contained in:
zzz
2019-02-03 12:59:53 +00:00
parent d7808cd16d
commit 7d11fb269e
9 changed files with 48 additions and 35 deletions

View File

@ -109,7 +109,10 @@ public class KeyManager {
*/
public synchronized SigningPublicKey getSigningPublicKey() { return _signingPublicKey; }
/** client */
/**
* client
* @param leaseRevocationPrivateKey unused, may be null
*/
public void registerKeys(Destination dest, SigningPrivateKey leaseRevocationPrivateKey, PrivateKey endpointDecryptionKey) {
if (_log.shouldLog(Log.INFO))
_log.info("Registering keys for destination " + dest.calculateHash().toBase64());

View File

@ -8,20 +8,13 @@ package net.i2p.router;
*
*/
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import net.i2p.data.DataFormatException;
import net.i2p.data.DataHelper;
import net.i2p.data.DataStructureImpl;
import net.i2p.data.Destination;
import net.i2p.data.PrivateKey;
import net.i2p.data.SigningPrivateKey;
/**
* Wrap up the keys given to the router when a destination connects to it.
* Used only by KeyManager.
* Used by KeyManager, ClientMessageEventListener, GarlicMessageReceiver.
*/
public class LeaseSetKeys {
private final SigningPrivateKey _revocationKey;
@ -29,7 +22,7 @@ public class LeaseSetKeys {
/**
* @param dest unused
* @param revocationKey unused
* @param revocationKey unused, may be null
* @param decryptionKey non-null
*/
public LeaseSetKeys(Destination dest, SigningPrivateKey revocationKey, PrivateKey decryptionKey) {

View File

@ -508,8 +508,14 @@ class ClientMessageEventListener implements I2CPMessageReader.I2CPMessageEventLi
return;
}
int type = ls.getType();
if (type != DatabaseEntry.KEY_TYPE_META_LS2 &&
(message.getPrivateKey() == null || message.getSigningPrivateKey() == null)) {
if (type != DatabaseEntry.KEY_TYPE_META_LS2 && message.getPrivateKey() == null) {
if (_log.shouldLog(Log.ERROR))
_log.error("Null private keys: " + message);
_runner.disconnectClient("Invalid CreateLeaseSetMessage - null private keys");
return;
}
if (type == DatabaseEntry.KEY_TYPE_LEASESET && message.getSigningPrivateKey() == null) {
// revocation keys only in LS1
if (_log.shouldLog(Log.ERROR))
_log.error("Null private keys: " + message);
_runner.disconnectClient("Invalid CreateLeaseSetMessage - null private keys");

View File

@ -10,7 +10,6 @@ package net.i2p.router.client;
import net.i2p.data.LeaseSet;
import net.i2p.data.PrivateKey;
import net.i2p.data.SigningPrivateKey;
import net.i2p.router.Job;
/**