propagate from branch 'i2p.i2p.zzz.i2pcontrol' (head 1334d424003d201aa352cf57a6ba2f61241ef363)

to branch 'i2p.i2p' (head fe8a90fdbdd491e16040e3ed91a35faa72fd78f2)
This commit is contained in:
zzz
2019-01-28 15:10:30 +00:00
129 changed files with 51913 additions and 42676 deletions

View File

@ -18,7 +18,7 @@ public class CoreVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = "0.9.37";
public final static String VERSION = "0.9.38";
/**
* For Vuze.

View File

@ -209,8 +209,7 @@ public abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2
private static final long MAX_SEND_WAIT = 10*1000;
private static final String MIN_FAST_VERSION = "0.9.4";
////// TESTING, change to 38 before release
private static final String MIN_LS2_VERSION = "0.9.37";
private static final String MIN_LS2_VERSION = "0.9.38";
/** @param routerVersion as rcvd in the SetDateMessage, may be null for very old routers */
void dateUpdated(String routerVersion) {

View File

@ -128,6 +128,8 @@ class RequestLeaseSetMessageHandler extends HandlerImpl {
session.destroySession();
return;
}
if (Boolean.parseBoolean(session.getOptions().getProperty("i2cp.dontPublishLeaseSet")))
((LeaseSet2)leaseSet).setUnpublished();
} else {
leaseSet = new LeaseSet();
}

View File

@ -53,6 +53,8 @@ class RequestVariableLeaseSetMessageHandler extends RequestLeaseSetMessageHandle
session.destroySession();
return;
}
if (Boolean.parseBoolean(session.getOptions().getProperty("i2cp.dontPublishLeaseSet")))
((LeaseSet2)leaseSet).setUnpublished();
} else {
leaseSet = new LeaseSet();
}

View File

@ -30,16 +30,26 @@ public enum EncType {
*/
ELGAMAL_2048(0, 256, 256, EncAlgo.ELGAMAL, "ElGamal/None/NoPadding", CryptoConstants.I2P_ELGAMAL_2048_SPEC, "0"),
/** Pubkey 64 bytes; privkey 32 bytes; */
EC_P256(1, 64, 32, EncAlgo.EC, "EC/None/NoPadding", ECConstants.P256_SPEC, "0.9.20"),
/** Pubkey 96 bytes; privkey 48 bytes; */
EC_P384(2, 96, 48, EncAlgo.EC, "EC/None/NoPadding", ECConstants.P384_SPEC, "0.9.20"),
/** Pubkey 132 bytes; privkey 66 bytes; */
EC_P521(3, 132, 66, EncAlgo.EC, "EC/None/NoPadding", ECConstants.P521_SPEC, "0.9.20"),
/**
* Used by i2pd. Not yet supported by Java I2P.
* Pubkey 64 bytes; privkey 32 bytes.
*/
EC_P256(1, 64, 32, EncAlgo.EC, "EC/None/NoPadding", ECConstants.P256_SPEC, "0.9.38"),
/**
* Reserved, not used by anybody.
* Pubkey 96 bytes; privkey 48 bytes.
*/
EC_P384(2, 96, 48, EncAlgo.EC, "EC/None/NoPadding", ECConstants.P384_SPEC, "0.9.38"),
/**
* Reserved, not used by anybody.
* Pubkey 132 bytes; privkey 66 bytes.
*/
EC_P521(3, 132, 66, EncAlgo.EC, "EC/None/NoPadding", ECConstants.P521_SPEC, "0.9.38"),
/**
* Proposal 144. Not yet supported by anybody.
* Pubkey 32 bytes; privkey 32 bytes
* @since 0.9.38
*/

View File

@ -298,6 +298,7 @@ public class EncryptedLeaseSet extends LeaseSet2 {
buf.append("\n\tTransient Expires: ").append(new java.util.Date(_transientExpires));
buf.append("\n\tOffline Signature: ").append(_offlineSignature);
}
buf.append("\n\tUnpublished? ").append(isUnpublished());
buf.append("\n\tSignature: ").append(_signature);
buf.append("\n\tPublished: ").append(new java.util.Date(_published));
buf.append("\n\tExpires: ").append(new java.util.Date(_expires));

View File

@ -59,6 +59,18 @@ public class LeaseSet2 extends LeaseSet {
public void setUnpublished() {
_flags |= FLAG_UNPUBLISHED;
}
/**
* If true, we received this LeaseSet by a remote peer publishing it to
* us, AND the unpublished flag is not set.
* Default false.
*
* @since 0.9.39 overridden
*/
@Override
public boolean getReceivedAsPublished() {
return super.getReceivedAsPublished() && !isUnpublished();
}
public String getOption(String opt) {
if (_options == null)
@ -66,6 +78,24 @@ public class LeaseSet2 extends LeaseSet {
return _options.getProperty(opt);
}
/**
* If more than one key, return the first supported one.
* If none supported, return the first one.
*
* @since 0.9.39 overridden
*/
@Override
public PublicKey getEncryptionKey() {
if (_encryptionKeys != null) {
for (PublicKey pk : _encryptionKeys) {
EncType type = pk.getType();
if (type != null && type.isAvailable())
return pk;
}
}
return _encryptionKey;
}
/**
* Add an encryption key.
*/
@ -120,6 +150,13 @@ public class LeaseSet2 extends LeaseSet {
return (_flags & FLAG_OFFLINE_KEYS) != 0;
}
/**
* @return transient public key or null if not offline signed
*/
public SigningPublicKey getTransientSigningKey() {
return _transientSigningPublicKey;
}
/**
* Destination must be previously set.
*
@ -533,6 +570,7 @@ public class LeaseSet2 extends LeaseSet {
buf.append("\n\t\t[").append(key).append("] = [").append(val).append("]");
}
}
buf.append("\n\tUnpublished? ").append(isUnpublished());
buf.append("\n\tSignature: ").append(_signature);
buf.append("\n\tPublished: ").append(new java.util.Date(_published));
buf.append("\n\tExpires: ").append(new java.util.Date(_expires));

View File

@ -171,6 +171,7 @@ public class MetaLeaseSet extends LeaseSet2 {
buf.append("\n\t\t[").append(key).append("] = [").append(val).append("]");
}
}
buf.append("\n\tUnpublished? ").append(isUnpublished());
buf.append("\n\tSignature: ").append(_signature);
buf.append("\n\tPublished: ").append(new java.util.Date(_published));
buf.append("\n\tExpires: ").append(new java.util.Date(_expires));