forked from I2P_Developers/i2p.i2p
* Certificate: Fix creation bug; improve router cert generation
This commit is contained in:
@@ -44,7 +44,7 @@ public class Certificate extends DataStructureImpl {
|
|||||||
public final static int CERTIFICATE_TYPE_MULTIPLE = 4;
|
public final static int CERTIFICATE_TYPE_MULTIPLE = 4;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pull from cache or return new
|
* If null cert, return immutable static instance, else create new
|
||||||
* @throws AIOOBE if not enough bytes
|
* @throws AIOOBE if not enough bytes
|
||||||
* @since 0.8.3
|
* @since 0.8.3
|
||||||
*/
|
*/
|
||||||
@@ -57,7 +57,7 @@ public class Certificate extends DataStructureImpl {
|
|||||||
if (length == 0)
|
if (length == 0)
|
||||||
return new Certificate(type, null);
|
return new Certificate(type, null);
|
||||||
byte[] payload = new byte[length];
|
byte[] payload = new byte[length];
|
||||||
System.arraycopy(data, off = 3, payload, 0, length);
|
System.arraycopy(data, off + 3, payload, 0, length);
|
||||||
return new Certificate(type, payload);
|
return new Certificate(type, payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -539,16 +539,14 @@ public class Router {
|
|||||||
return true;
|
return true;
|
||||||
return Boolean.valueOf(_context.getProperty(PROP_HIDDEN_HIDDEN)).booleanValue();
|
return Boolean.valueOf(_context.getProperty(PROP_HIDDEN_HIDDEN)).booleanValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the certificate for a new RouterInfo - probably a null cert.
|
||||||
|
*/
|
||||||
public Certificate createCertificate() {
|
public Certificate createCertificate() {
|
||||||
Certificate cert = new Certificate();
|
if (isHidden())
|
||||||
if (isHidden()) {
|
return new Certificate(Certificate.CERTIFICATE_TYPE_HIDDEN, null);
|
||||||
cert.setCertificateType(Certificate.CERTIFICATE_TYPE_HIDDEN);
|
return Certificate.NULL_CERT;
|
||||||
cert.setPayload(null);
|
|
||||||
} else {
|
|
||||||
cert.setCertificateType(Certificate.CERTIFICATE_TYPE_NULL);
|
|
||||||
cert.setPayload(null);
|
|
||||||
}
|
|
||||||
return cert;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user