I2CP, NetDB, Console: Encrypted LS2 handling fixes (WIP)

log tweaks
This commit is contained in:
zzz
2019-03-02 21:52:12 +00:00
parent 7cbb43ab75
commit 54d9a29855
6 changed files with 78 additions and 18 deletions

View File

@@ -286,6 +286,8 @@ public class EncryptedLeaseSet extends LeaseSet2 {
}
/**
* This must be used instead of getDestination().getHash().
*
* Overridden because we have a blinded key, not a dest.
* This is the hash of the signing public key type and the signing public key.
* Throws IllegalStateException if not initialized.
@@ -537,6 +539,9 @@ public class EncryptedLeaseSet extends LeaseSet2 {
*/
@Override
public boolean verifySignature() {
// TODO use fields in super
if (_decryptedLS2 != null)
return _decryptedLS2.verifySignature();
if (_log.shouldDebug()) {
_log.debug("Sig verify outer with key: " + _signingKey.getType() + ' ' + _signingKey.toBase64());
_log.debug("Outer sig: " + _signature.getType() + ' ' + _signature.toBase64());
@@ -596,6 +601,8 @@ public class EncryptedLeaseSet extends LeaseSet2 {
StringBuilder buf = new StringBuilder(128);
buf.append("[EncryptedLeaseSet: ");
buf.append("\n\tBlinded Key: ").append(_signingKey);
buf.append("\n\tHash: ").append(getHash());
buf.append("\n\tB32: ").append(getHash().toBase32());
if (isOffline()) {
buf.append("\n\tTransient Key: ").append(_transientSigningPublicKey);
buf.append("\n\tTransient Expires: ").append(new java.util.Date(_transientExpires));

View File

@@ -402,9 +402,9 @@ public class LeaseSet extends DatabaseEntry {
StringBuilder buf = new StringBuilder(128);
buf.append("[LeaseSet: ");
buf.append("\n\tDestination: ").append(_destination);
buf.append("\n\tB32: ").append(_destination.toBase32());
buf.append("\n\tEncryptionKey: ").append(_encryptionKey);
buf.append("\n\tSigningKey: ").append(_signingKey);
//buf.append("\n\tVersion: ").append(getVersion());
buf.append("\n\tSignature: ").append(_signature);
buf.append("\n\tLeases: #").append(getLeaseCount());
for (int i = 0; i < getLeaseCount(); i++)

View File

@@ -55,7 +55,7 @@ public class LeaseSet2 extends LeaseSet {
/**
* Published timestamp, as received.
* Different than getDate(), which is the earliest lease expiration.
* Different than getDate() or getEarliestLeaseDate(), which are the earliest lease expiration.
*
* @return in ms, with 1 second resolution
* @since 0.9.39
@@ -64,6 +64,17 @@ public class LeaseSet2 extends LeaseSet {
return _published;
}
/**
* Published expiration, as received.
* May be different than getLatestLeaseDate(), which is the latest lease expiration.
*
* @return in ms, with 1 second resolution
* @since 0.9.39
*/
public long getExpires() {
return _expires;
}
public boolean isUnpublished() {
return (_flags & FLAG_UNPUBLISHED) != 0;
}
@@ -578,6 +589,7 @@ public class LeaseSet2 extends LeaseSet {
StringBuilder buf = new StringBuilder(128);
buf.append("[LeaseSet2: ");
buf.append("\n\tDestination: ").append(_destination);
buf.append("\n\tB32: ").append(_destination.toBase32());
List<PublicKey> keys = getEncryptionKeys();
int sz = keys.size();
buf.append("\n\tEncryption Keys: ").append(sz);