and another bunch
This commit is contained in:
@ -70,6 +70,7 @@ public class AESInputStream extends FilterInputStream {
|
||||
_eofFound = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
while ((!_eofFound) && (_decryptedSize <= 0)) {
|
||||
refill();
|
||||
@ -88,10 +89,12 @@ public class AESInputStream extends FilterInputStream {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte dest[]) throws IOException {
|
||||
return read(dest, 0, dest.length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte dest[], int off, int len) throws IOException {
|
||||
for (int i = 0; i < len; i++) {
|
||||
int val = read();
|
||||
@ -121,6 +124,7 @@ public class AESInputStream extends FilterInputStream {
|
||||
return len;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long skip(long numBytes) throws IOException {
|
||||
for (long l = 0; l < numBytes; l++) {
|
||||
int val = read();
|
||||
@ -129,10 +133,12 @@ public class AESInputStream extends FilterInputStream {
|
||||
return numBytes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int available() throws IOException {
|
||||
return _decryptedSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
in.close();
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
@ -141,13 +147,16 @@ public class AESInputStream extends FilterInputStream {
|
||||
+ _writesSinceDecrypt + " still encrypted]");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mark(int readLimit) { // nop
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() throws IOException {
|
||||
throw new IOException("Reset not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean markSupported() {
|
||||
return false;
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ public class AESOutputStream extends FilterOutputStream {
|
||||
_writesSinceCommit = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int val) throws IOException {
|
||||
_cumulativeProvided++;
|
||||
_unencryptedBuf[_writesSinceCommit++] = (byte)(val & 0xFF);
|
||||
@ -70,10 +71,12 @@ public class AESOutputStream extends FilterOutputStream {
|
||||
doFlush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte src[]) throws IOException {
|
||||
write(src, 0, src.length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte src[], int off, int len) throws IOException {
|
||||
// i'm too lazy to unroll this into the partial writes (dealing with
|
||||
// wrapping around the buffer size)
|
||||
@ -81,6 +84,7 @@ public class AESOutputStream extends FilterOutputStream {
|
||||
write(src[i+off]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
flush();
|
||||
out.close();
|
||||
@ -89,6 +93,7 @@ public class AESOutputStream extends FilterOutputStream {
|
||||
+ _cumulativeProvided + "/" + _cumulativeWritten + "/" + _cumulativePadding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws IOException {
|
||||
doFlush();
|
||||
out.flush();
|
||||
|
@ -41,10 +41,12 @@ public class CryptixAESEngine extends AESEngine {
|
||||
_cache = new CryptixAESKeyCache();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encrypt(byte payload[], int payloadIndex, byte out[], int outIndex, SessionKey sessionKey, byte iv[], int length) {
|
||||
encrypt(payload, payloadIndex, out, outIndex, sessionKey, iv, 0, length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encrypt(byte payload[], int payloadIndex, byte out[], int outIndex, SessionKey sessionKey, byte iv[], int ivOffset, int length) {
|
||||
if ( (payload == null) || (out == null) || (sessionKey == null) || (iv == null) )
|
||||
throw new NullPointerException("invalid args to aes");
|
||||
@ -73,9 +75,11 @@ public class CryptixAESEngine extends AESEngine {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decrypt(byte payload[], int payloadIndex, byte out[], int outIndex, SessionKey sessionKey, byte iv[], int length) {
|
||||
decrypt(payload, payloadIndex, out, outIndex, sessionKey, iv, 0, length);
|
||||
}
|
||||
@Override
|
||||
public void decrypt(byte payload[], int payloadIndex, byte out[], int outIndex, SessionKey sessionKey, byte iv[], int ivOffset, int length) {
|
||||
if ((iv== null) || (payload == null) || (payload.length <= 0) || (sessionKey == null) )
|
||||
throw new IllegalArgumentException("bad setup");
|
||||
@ -122,6 +126,7 @@ public class CryptixAESEngine extends AESEngine {
|
||||
_prevCache.release(curA);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void encryptBlock(byte payload[], int inIndex, SessionKey sessionKey, byte out[], int outIndex) {
|
||||
if (sessionKey.getPreparedKey() == null) {
|
||||
try {
|
||||
@ -140,6 +145,7 @@ public class CryptixAESEngine extends AESEngine {
|
||||
* @param payload encrypted data
|
||||
* @param sessionKey private session key
|
||||
*/
|
||||
@Override
|
||||
public final void decryptBlock(byte payload[], int inIndex, SessionKey sessionKey, byte rv[], int outIndex) {
|
||||
if ( (payload == null) || (rv == null) )
|
||||
throw new IllegalArgumentException("null block args [payload=" + payload + " rv="+rv);
|
||||
|
@ -485,6 +485,7 @@ public class DHSessionKeyBuilder {
|
||||
_maxSize = maxSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
while (true) {
|
||||
|
||||
|
@ -14,10 +14,12 @@ public class DummyDSAEngine extends DSAEngine {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean verifySignature(Signature signature, byte signedData[], SigningPublicKey verifyingKey) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Signature sign(byte data[], SigningPrivateKey signingKey) {
|
||||
Signature sig = new Signature();
|
||||
sig.setData(Signature.FAKE_SIGNATURE);
|
||||
|
@ -46,6 +46,7 @@ public class DummyElGamalEngine extends ElGamalEngine {
|
||||
* @param publicKey public key encrypt to
|
||||
* @param data data to encrypt
|
||||
*/
|
||||
@Override
|
||||
public byte[] encrypt(byte data[], PublicKey publicKey) {
|
||||
if ((data == null) || (data.length >= 223))
|
||||
throw new IllegalArgumentException("Data to encrypt must be < 223 bytes at the moment");
|
||||
@ -72,6 +73,7 @@ public class DummyElGamalEngine extends ElGamalEngine {
|
||||
* @param privateKey private key to decrypt with
|
||||
* @return unencrypted data
|
||||
*/
|
||||
@Override
|
||||
public byte[] decrypt(byte encrypted[], PrivateKey privateKey) {
|
||||
if ((encrypted == null) || (encrypted.length > 514))
|
||||
throw new IllegalArgumentException("Data to decrypt must be <= 514 bytes at the moment");
|
||||
|
@ -14,6 +14,7 @@ public class DummyPooledRandomSource extends PooledRandomSource {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initializePool(I2PAppContext context) {
|
||||
_pool = new RandomSource[POOL_SIZE];
|
||||
for (int i = 0; i < POOL_SIZE; i++) {
|
||||
@ -40,6 +41,7 @@ public class DummyPooledRandomSource extends PooledRandomSource {
|
||||
* thats what it has been used for.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public int nextInt(int n) {
|
||||
if (n == 0) return 0;
|
||||
int val = _prng.nextInt(n);
|
||||
@ -52,6 +54,7 @@ public class DummyPooledRandomSource extends PooledRandomSource {
|
||||
* Like the modified nextInt, nextLong(n) returns a random number from 0 through n,
|
||||
* including 0, excluding n.
|
||||
*/
|
||||
@Override
|
||||
public long nextLong(long n) {
|
||||
long v = _prng.nextLong();
|
||||
if (v < 0) v = 0 - v;
|
||||
@ -63,36 +66,43 @@ public class DummyPooledRandomSource extends PooledRandomSource {
|
||||
* override as synchronized, for those JVMs that don't always pull via
|
||||
* nextBytes (cough ibm)
|
||||
*/
|
||||
@Override
|
||||
public boolean nextBoolean() { return _prng.nextBoolean(); }
|
||||
/**
|
||||
* override as synchronized, for those JVMs that don't always pull via
|
||||
* nextBytes (cough ibm)
|
||||
*/
|
||||
@Override
|
||||
public void nextBytes(byte buf[]) { _prng.nextBytes(buf); }
|
||||
/**
|
||||
* override as synchronized, for those JVMs that don't always pull via
|
||||
* nextBytes (cough ibm)
|
||||
*/
|
||||
@Override
|
||||
public double nextDouble() { return _prng.nextDouble(); }
|
||||
/**
|
||||
* override as synchronized, for those JVMs that don't always pull via
|
||||
* nextBytes (cough ibm)
|
||||
*/
|
||||
@Override
|
||||
public float nextFloat() { return _prng.nextFloat(); }
|
||||
/**
|
||||
* override as synchronized, for those JVMs that don't always pull via
|
||||
* nextBytes (cough ibm)
|
||||
*/
|
||||
@Override
|
||||
public double nextGaussian() { return _prng.nextGaussian(); }
|
||||
/**
|
||||
* override as synchronized, for those JVMs that don't always pull via
|
||||
* nextBytes (cough ibm)
|
||||
*/
|
||||
@Override
|
||||
public int nextInt() { return _prng.nextInt(); }
|
||||
/**
|
||||
* override as synchronized, for those JVMs that don't always pull via
|
||||
* nextBytes (cough ibm)
|
||||
*/
|
||||
@Override
|
||||
public long nextLong() { return _prng.nextLong(); }
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import org.bouncycastle.crypto.macs.HMac;
|
||||
public class HMAC256Generator extends HMACGenerator {
|
||||
public HMAC256Generator(I2PAppContext context) { super(context); }
|
||||
|
||||
@Override
|
||||
protected HMac acquire() {
|
||||
synchronized (_available) {
|
||||
if (_available.size() > 0)
|
||||
@ -30,8 +31,11 @@ public class HMAC256Generator extends HMACGenerator {
|
||||
}
|
||||
|
||||
private class Sha256ForMAC extends Sha256Standalone implements Digest {
|
||||
@Override
|
||||
public String getAlgorithmName() { return "sha256 for hmac"; }
|
||||
@Override
|
||||
public int getDigestSize() { return 32; }
|
||||
@Override
|
||||
public int doFinal(byte[] out, int outOff) {
|
||||
byte rv[] = digest();
|
||||
System.arraycopy(rv, 0, out, outOff, rv.length);
|
||||
|
@ -97,6 +97,7 @@ public final class SHA1 extends MessageDigest implements Cloneable {
|
||||
/**
|
||||
* Clones this object.
|
||||
*/
|
||||
@Override
|
||||
public Object clone() throws CloneNotSupportedException {
|
||||
SHA1 that = (SHA1)super.clone();
|
||||
that.pad = (byte[])this.pad.clone();
|
||||
@ -113,6 +114,7 @@ public final class SHA1 extends MessageDigest implements Cloneable {
|
||||
* <code>java.security.MessageDigestSpi</code>.
|
||||
* @return the digest length in bytes.
|
||||
*/
|
||||
@Override
|
||||
public int engineGetDigestLength() {
|
||||
return HASH_LENGTH;
|
||||
}
|
||||
@ -123,6 +125,7 @@ public final class SHA1 extends MessageDigest implements Cloneable {
|
||||
* Overrides the protected abstract method of
|
||||
* <code>java.security.MessageDigestSpi</code>.
|
||||
*/
|
||||
@Override
|
||||
protected void engineReset() {
|
||||
int i = 60;
|
||||
do {
|
||||
@ -179,6 +182,7 @@ public final class SHA1 extends MessageDigest implements Cloneable {
|
||||
* @param offset the offset to start from in the array of bytes.
|
||||
* @param len the number of bytes to use, starting at offset.
|
||||
*/
|
||||
@Override
|
||||
public void engineUpdate(byte[] input, int offset, int len) {
|
||||
if (offset >= 0 && len >= 0 && offset + len <= input.length) {
|
||||
bytes += len;
|
||||
@ -234,6 +238,7 @@ public final class SHA1 extends MessageDigest implements Cloneable {
|
||||
* java.security.MessageDigestSpi.
|
||||
* @return the length of the digest stored in the output buffer.
|
||||
*/
|
||||
@Override
|
||||
public byte[] engineDigest() {
|
||||
try {
|
||||
final byte hashvalue[] = new byte[HASH_LENGTH];
|
||||
@ -264,6 +269,7 @@ public final class SHA1 extends MessageDigest implements Cloneable {
|
||||
* length.
|
||||
* @return the length of the digest stored in the output buffer.
|
||||
*/
|
||||
@Override
|
||||
public int engineDigest(byte[] hashvalue, int offset, final int len)
|
||||
throws DigestException {
|
||||
if (len >= HASH_LENGTH) {
|
||||
|
@ -75,6 +75,7 @@ class TransientSessionKeyManager extends SessionKeyManager {
|
||||
private TransientSessionKeyManager() { this(null); }
|
||||
|
||||
private class CleanupEvent implements SimpleTimer.TimedEvent {
|
||||
@Override
|
||||
public void timeReached() {
|
||||
long beforeExpire = _context.clock().now();
|
||||
int expired = aggressiveExpire();
|
||||
@ -130,6 +131,7 @@ class TransientSessionKeyManager extends SessionKeyManager {
|
||||
* or null if a new session key should be generated.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public SessionKey getCurrentKey(PublicKey target) {
|
||||
OutboundSession sess = getSession(target);
|
||||
if (sess == null) return null;
|
||||
@ -151,6 +153,7 @@ class TransientSessionKeyManager extends SessionKeyManager {
|
||||
* when to expire that key begin with this call.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void createSession(PublicKey target, SessionKey key) {
|
||||
OutboundSession sess = new OutboundSession(target);
|
||||
sess.setCurrentKey(key);
|
||||
@ -164,6 +167,7 @@ class TransientSessionKeyManager extends SessionKeyManager {
|
||||
* NOT be used)
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public SessionTag consumeNextAvailableTag(PublicKey target, SessionKey key) {
|
||||
OutboundSession sess = getSession(target);
|
||||
if (sess == null) {
|
||||
@ -187,6 +191,7 @@ class TransientSessionKeyManager extends SessionKeyManager {
|
||||
* have been confirmed and are available
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public int getAvailableTags(PublicKey target, SessionKey key) {
|
||||
OutboundSession sess = getSession(target);
|
||||
if (sess == null) { return 0; }
|
||||
@ -200,6 +205,7 @@ class TransientSessionKeyManager extends SessionKeyManager {
|
||||
* Determine how long the available tags will be available for before expiring, in
|
||||
* milliseconds
|
||||
*/
|
||||
@Override
|
||||
public long getAvailableTimeLeft(PublicKey target, SessionKey key) {
|
||||
OutboundSession sess = getSession(target);
|
||||
if (sess == null) { return 0; }
|
||||
@ -219,6 +225,7 @@ class TransientSessionKeyManager extends SessionKeyManager {
|
||||
* method after receiving an ack to a message delivering them)
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void tagsDelivered(PublicKey target, SessionKey key, Set sessionTags) {
|
||||
if (_log.shouldLog(Log.DEBUG)) {
|
||||
//_log.debug("Tags delivered to set " + set + " on session " + sess);
|
||||
@ -241,6 +248,7 @@ class TransientSessionKeyManager extends SessionKeyManager {
|
||||
* from corrupted tag sets and crashes
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void failTags(PublicKey target) {
|
||||
removeSession(target);
|
||||
}
|
||||
@ -249,6 +257,7 @@ class TransientSessionKeyManager extends SessionKeyManager {
|
||||
* Accept the given tags and associate them with the given key for decryption
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void tagsReceived(SessionKey key, Set sessionTags) {
|
||||
int overage = 0;
|
||||
TagSet tagSet = new TagSet(sessionTags, key, _context.clock().now());
|
||||
@ -360,6 +369,7 @@ class TransientSessionKeyManager extends SessionKeyManager {
|
||||
* matches
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public SessionKey consumeTag(SessionTag tag) {
|
||||
if (false) aggressiveExpire();
|
||||
synchronized (_inboundTagSets) {
|
||||
@ -712,6 +722,7 @@ class TransientSessionKeyManager extends SessionKeyManager {
|
||||
|
||||
public Exception getCreatedBy() { return _createdBy; }
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
long rv = 0;
|
||||
if (_key != null) rv = rv * 7 + _key.hashCode();
|
||||
@ -720,6 +731,7 @@ class TransientSessionKeyManager extends SessionKeyManager {
|
||||
return (int) rv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if ((o == null) || !(o instanceof TagSet)) return false;
|
||||
TagSet ts = (TagSet) o;
|
||||
|
@ -42,6 +42,7 @@ public class Address extends DataStructureImpl {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException,
|
||||
IOException {
|
||||
_hostname = DataHelper.readString(in);
|
||||
@ -49,6 +50,7 @@ public class Address extends DataStructureImpl {
|
||||
_destination.readBytes(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException,
|
||||
IOException {
|
||||
if ((_hostname == null) || (_destination == null))
|
||||
@ -57,6 +59,7 @@ public class Address extends DataStructureImpl {
|
||||
_destination.writeBytes(out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if ((obj == null) || !(obj instanceof Address)) return false;
|
||||
Address addr = (Address) obj;
|
||||
@ -64,11 +67,13 @@ public class Address extends DataStructureImpl {
|
||||
&& DataHelper.eq(_destination, addr.getDestination());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return DataHelper.hashCode(getHostname())
|
||||
+ DataHelper.hashCode(getDestination());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer buf = new StringBuffer(64);
|
||||
buf.append("[Address: ");
|
||||
|
@ -54,6 +54,7 @@ public class ByteArray implements Serializable, Comparable {
|
||||
public int getOffset() { return _offset; }
|
||||
public void setOffset(int offset) { _offset = offset; }
|
||||
|
||||
@Override
|
||||
public final boolean equals(Object o) {
|
||||
if (o == null) return false;
|
||||
if (o instanceof ByteArray) {
|
||||
@ -73,15 +74,18 @@ public class ByteArray implements Serializable, Comparable {
|
||||
return (llen == rlen) && DataHelper.eq(lhs, loff, rhs, roff, llen);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int compareTo(Object obj) {
|
||||
if (obj.getClass() != getClass()) throw new ClassCastException("invalid object: " + obj);
|
||||
return DataHelper.compareTo(_data, ((ByteArray)obj).getData());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int hashCode() {
|
||||
return DataHelper.hashCode(getData());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + "/" + DataHelper.toString(getData(), 32) + "." + _valid;
|
||||
}
|
||||
|
@ -67,6 +67,7 @@ public class Certificate extends DataStructureImpl {
|
||||
_payload = payload;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_type = (int) DataHelper.readLong(in, 1);
|
||||
int length = (int) DataHelper.readLong(in, 2);
|
||||
@ -79,6 +80,7 @@ public class Certificate extends DataStructureImpl {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_type < 0) throw new DataFormatException("Invalid certificate type: " + _type);
|
||||
//if ((_type != 0) && (_payload == null)) throw new DataFormatException("Payload is required for non null type");
|
||||
@ -135,16 +137,17 @@ public class Certificate extends DataStructureImpl {
|
||||
return 1 + 2 + (_payload != null ? _payload.length : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if ((object == null) || !(object instanceof Certificate)) return false;
|
||||
Certificate cert = (Certificate) object;
|
||||
return getCertificateType() == cert.getCertificateType() && DataHelper.eq(getPayload(), cert.getPayload());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getCertificateType() + DataHelper.hashCode(getPayload());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer buf = new StringBuffer(64);
|
||||
buf.append("[Certificate: type: ");
|
||||
|
@ -25,6 +25,7 @@ import net.i2p.util.Log;
|
||||
public abstract class DataStructureImpl implements DataStructure {
|
||||
private final static Log _log = new Log(DataStructureImpl.class);
|
||||
|
||||
@Override
|
||||
public String toBase64() {
|
||||
byte data[] = toByteArray();
|
||||
if (data == null)
|
||||
@ -32,19 +33,19 @@ public abstract class DataStructureImpl implements DataStructure {
|
||||
|
||||
return Base64.encode(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBase64(String data) throws DataFormatException {
|
||||
if (data == null) throw new DataFormatException("Null data passed in");
|
||||
byte bytes[] = Base64.decode(data);
|
||||
fromByteArray(bytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Hash calculateHash() {
|
||||
byte data[] = toByteArray();
|
||||
if (data != null) return SHA256Generator.getInstance().calculateHash(data);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] toByteArray() {
|
||||
try {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream(512);
|
||||
@ -58,7 +59,7 @@ public abstract class DataStructureImpl implements DataStructure {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromByteArray(byte data[]) throws DataFormatException {
|
||||
if (data == null) throw new DataFormatException("Null data passed in");
|
||||
try {
|
||||
|
@ -72,6 +72,7 @@ public class Destination extends DataStructureImpl {
|
||||
__calculatedHash = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_publicKey = new PublicKey();
|
||||
_publicKey.readBytes(in);
|
||||
@ -82,6 +83,7 @@ public class Destination extends DataStructureImpl {
|
||||
__calculatedHash = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if ((_certificate == null) || (_publicKey == null) || (_signingKey == null))
|
||||
throw new DataFormatException("Not enough data to format the destination");
|
||||
@ -128,6 +130,7 @@ public class Destination extends DataStructureImpl {
|
||||
return PublicKey.KEYSIZE_BYTES + SigningPublicKey.KEYSIZE_BYTES + _certificate.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if ((object == null) || !(object instanceof Destination)) return false;
|
||||
Destination dst = (Destination) object;
|
||||
@ -136,11 +139,13 @@ public class Destination extends DataStructureImpl {
|
||||
&& DataHelper.eq(getPublicKey(), dst.getPublicKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return DataHelper.hashCode(getCertificate()) + DataHelper.hashCode(getSigningPublicKey())
|
||||
+ DataHelper.hashCode(getPublicKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer buf = new StringBuffer(128);
|
||||
buf.append("[Destination: ");
|
||||
@ -152,6 +157,7 @@ public class Destination extends DataStructureImpl {
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Hash calculateHash() {
|
||||
if (__calculatedHash == null) __calculatedHash = super.calculateHash();
|
||||
return __calculatedHash;
|
||||
|
@ -127,6 +127,7 @@ public class Hash extends DataStructureImpl {
|
||||
_xorCache = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_data = new byte[HASH_LENGTH];
|
||||
_stringified = null;
|
||||
@ -135,21 +136,25 @@ public class Hash extends DataStructureImpl {
|
||||
if (read != HASH_LENGTH) throw new DataFormatException("Not enough bytes to read the hash");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_data == null) throw new DataFormatException("No data in the hash to write out");
|
||||
if (_data.length != HASH_LENGTH) throw new DataFormatException("Invalid size of data in the private key");
|
||||
out.write(_data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if ((obj == null) || !(obj instanceof Hash)) return false;
|
||||
return DataHelper.eq(_data, ((Hash) obj)._data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return DataHelper.hashCode(_data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (_stringified == null) {
|
||||
StringBuffer buf = new StringBuffer(64);
|
||||
@ -165,6 +170,7 @@ public class Hash extends DataStructureImpl {
|
||||
return _stringified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toBase64() {
|
||||
if (_base64ed == null) {
|
||||
_base64ed = super.toBase64();
|
||||
|
@ -112,6 +112,7 @@ public class Lease extends DataStructureImpl {
|
||||
return _end.getTime() < Clock.getInstance().now() - fudgeFactor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_gateway = new Hash();
|
||||
_gateway.readBytes(in);
|
||||
@ -120,6 +121,7 @@ public class Lease extends DataStructureImpl {
|
||||
_end = DataHelper.readDate(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if ((_gateway == null) || (_tunnelId == null))
|
||||
throw new DataFormatException("Not enough data to write out a Lease");
|
||||
@ -129,6 +131,7 @@ public class Lease extends DataStructureImpl {
|
||||
DataHelper.writeDate(out, _end);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if ((object == null) || !(object instanceof Lease)) return false;
|
||||
Lease lse = (Lease) object;
|
||||
@ -138,11 +141,13 @@ public class Lease extends DataStructureImpl {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return DataHelper.hashCode(getEndDate()) + DataHelper.hashCode(getGateway())
|
||||
+ DataHelper.hashCode(getTunnelId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer buf = new StringBuffer(128);
|
||||
buf.append("[Lease: ");
|
||||
|
@ -253,6 +253,7 @@ public class LeaseSet extends DataStructureImpl {
|
||||
return rv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_destination = new Destination();
|
||||
_destination.readBytes(in);
|
||||
@ -274,6 +275,7 @@ public class LeaseSet extends DataStructureImpl {
|
||||
_signature.readBytes(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if ((_destination == null) || (_encryptionKey == null) || (_signingKey == null) || (_leases == null)
|
||||
|| (_signature == null)) throw new DataFormatException("Not enough data to write out a LeaseSet");
|
||||
@ -300,6 +302,7 @@ public class LeaseSet extends DataStructureImpl {
|
||||
+ _leases.size() * (Hash.HASH_LENGTH + 4 + 8);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if ((object == null) || !(object instanceof LeaseSet)) return false;
|
||||
LeaseSet ls = (LeaseSet) object;
|
||||
@ -311,6 +314,7 @@ public class LeaseSet extends DataStructureImpl {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return DataHelper.hashCode(getEncryptionKey()) +
|
||||
//(int)_version +
|
||||
@ -318,6 +322,7 @@ public class LeaseSet extends DataStructureImpl {
|
||||
+ DataHelper.hashCode(getSigningKey()) + DataHelper.hashCode(getDestination());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer buf = new StringBuffer(128);
|
||||
buf.append("[LeaseSet: ");
|
||||
|
@ -67,6 +67,7 @@ public class Payload extends DataStructureImpl {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
int size = (int) DataHelper.readLong(in, 4);
|
||||
if (size < 0) throw new DataFormatException("payload size out of range (" + size + ")");
|
||||
@ -77,6 +78,7 @@ public class Payload extends DataStructureImpl {
|
||||
_log.debug("read payload: " + read + " bytes");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_encryptedData == null) throw new DataFormatException("Not yet encrypted. Please set the encrypted data");
|
||||
DataHelper.writeLong(out, 4, _encryptedData.length);
|
||||
@ -92,6 +94,7 @@ public class Payload extends DataStructureImpl {
|
||||
return 4 + _encryptedData.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if ((object == null) || !(object instanceof Payload)) return false;
|
||||
Payload p = (Payload) object;
|
||||
@ -99,10 +102,12 @@ public class Payload extends DataStructureImpl {
|
||||
&& DataHelper.eq(getEncryptedData(), p.getEncryptedData());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return DataHelper.hashCode(getUnencryptedData());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (true) return "[Payload]";
|
||||
StringBuffer buf = new StringBuffer(128);
|
||||
|
@ -51,12 +51,14 @@ public class PrivateKey extends DataStructureImpl {
|
||||
_data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_data = new byte[KEYSIZE_BYTES];
|
||||
int read = read(in, _data);
|
||||
if (read != KEYSIZE_BYTES) throw new DataFormatException("Not enough bytes to read the private key");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_data == null) throw new DataFormatException("No data in the private key to write out");
|
||||
if (_data.length != KEYSIZE_BYTES)
|
||||
@ -64,15 +66,18 @@ public class PrivateKey extends DataStructureImpl {
|
||||
out.write(_data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if ((obj == null) || !(obj instanceof PrivateKey)) return false;
|
||||
return DataHelper.eq(_data, ((PrivateKey) obj)._data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return DataHelper.hashCode(_data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer buf = new StringBuffer(64);
|
||||
buf.append("[PrivateKey: ");
|
||||
|
@ -54,27 +54,32 @@ public class PublicKey extends DataStructureImpl {
|
||||
_data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_data = new byte[KEYSIZE_BYTES];
|
||||
int read = read(in, _data);
|
||||
if (read != KEYSIZE_BYTES) throw new DataFormatException("Not enough bytes to read the public key");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_data == null) throw new DataFormatException("No data in the public key to write out");
|
||||
if (_data.length != KEYSIZE_BYTES) throw new DataFormatException("Invalid size of data in the public key");
|
||||
out.write(_data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if ((obj == null) || !(obj instanceof PublicKey)) return false;
|
||||
return DataHelper.eq(_data, ((PublicKey) obj)._data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return DataHelper.hashCode(_data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer buf = new StringBuffer(64);
|
||||
buf.append("[PublicKey: ");
|
||||
|
@ -105,6 +105,7 @@ public class RouterAddress extends DataStructureImpl {
|
||||
_options = options;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_cost = (int) DataHelper.readLong(in, 1);
|
||||
_expiration = DataHelper.readDate(in);
|
||||
@ -112,6 +113,7 @@ public class RouterAddress extends DataStructureImpl {
|
||||
_options = DataHelper.readProperties(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if ((_cost < 0) || (_transportStyle == null) || (_options == null))
|
||||
throw new DataFormatException("Not enough data to write a router address");
|
||||
@ -121,6 +123,7 @@ public class RouterAddress extends DataStructureImpl {
|
||||
DataHelper.writeProperties(out, _options);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if ((object == null) || !(object instanceof RouterAddress)) return false;
|
||||
RouterAddress addr = (RouterAddress) object;
|
||||
@ -129,11 +132,13 @@ public class RouterAddress extends DataStructureImpl {
|
||||
&& DataHelper.eq(getTransportStyle(), addr.getTransportStyle());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getCost() + DataHelper.hashCode(getTransportStyle()) + DataHelper.hashCode(getExpiration())
|
||||
+ DataHelper.hashCode(getOptions());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer buf = new StringBuffer(64);
|
||||
buf.append("[RouterAddress: ");
|
||||
|
@ -74,6 +74,7 @@ public class RouterIdentity extends DataStructureImpl {
|
||||
return (_certificate != null) && (_certificate.getCertificateType() == Certificate.CERTIFICATE_TYPE_HIDDEN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_publicKey = new PublicKey();
|
||||
_publicKey.readBytes(in);
|
||||
@ -84,6 +85,7 @@ public class RouterIdentity extends DataStructureImpl {
|
||||
__calculatedHash = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if ((_certificate == null) || (_publicKey == null) || (_signingKey == null))
|
||||
throw new DataFormatException("Not enough data to format the router identity");
|
||||
@ -92,6 +94,7 @@ public class RouterIdentity extends DataStructureImpl {
|
||||
_certificate.writeBytes(out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if ((object == null) || !(object instanceof RouterIdentity)) return false;
|
||||
RouterIdentity ident = (RouterIdentity) object;
|
||||
@ -100,11 +103,13 @@ public class RouterIdentity extends DataStructureImpl {
|
||||
&& DataHelper.eq(getPublicKey(), ident.getPublicKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return DataHelper.hashCode(getCertificate()) + DataHelper.hashCode(getSigningPublicKey())
|
||||
+ DataHelper.hashCode(getPublicKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer buf = new StringBuffer(64);
|
||||
buf.append("[RouterIdentity: ");
|
||||
@ -116,6 +121,7 @@ public class RouterIdentity extends DataStructureImpl {
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Hash calculateHash() {
|
||||
return getHash();
|
||||
}
|
||||
|
@ -487,6 +487,7 @@ public class RouterInfo extends DataStructureImpl {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_identity = new RouterIdentity();
|
||||
_identity.readBytes(in);
|
||||
@ -516,6 +517,7 @@ public class RouterInfo extends DataStructureImpl {
|
||||
//_log.debug("Read routerInfo: " + toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_identity == null) throw new DataFormatException("Missing identity");
|
||||
if (_published < 0) throw new DataFormatException("Invalid published date: " + _published);
|
||||
@ -531,6 +533,7 @@ public class RouterInfo extends DataStructureImpl {
|
||||
out.write(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if ((object == null) || !(object instanceof RouterInfo)) return false;
|
||||
RouterInfo info = (RouterInfo) object;
|
||||
@ -542,6 +545,7 @@ public class RouterInfo extends DataStructureImpl {
|
||||
&& DataHelper.eq(_peers, info.getPeers());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
if (!_hashCodeInitialized) {
|
||||
_hashCode = DataHelper.hashCode(_identity) + (int) getPublished();
|
||||
@ -550,6 +554,7 @@ public class RouterInfo extends DataStructureImpl {
|
||||
return _hashCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (_stringified != null) return _stringified;
|
||||
StringBuffer buf = new StringBuffer(5*1024);
|
||||
|
@ -58,27 +58,32 @@ public class SessionKey extends DataStructureImpl {
|
||||
public Object getPreparedKey() { return _preparedKey; }
|
||||
public void setPreparedKey(Object obj) { _preparedKey = obj; }
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_data = new byte[KEYSIZE_BYTES];
|
||||
int read = read(in, _data);
|
||||
if (read != KEYSIZE_BYTES) throw new DataFormatException("Not enough bytes to read the session key");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_data == null) throw new DataFormatException("No data in the session key to write out");
|
||||
if (_data.length != KEYSIZE_BYTES) throw new DataFormatException("Invalid size of data in the private key");
|
||||
out.write(_data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if ((obj == null) || !(obj instanceof SessionKey)) return false;
|
||||
return DataHelper.eq(_data, ((SessionKey) obj)._data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return DataHelper.hashCode(_data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (true) return super.toString();
|
||||
StringBuffer buf = new StringBuffer(64);
|
||||
|
@ -36,6 +36,7 @@ public class SessionTag extends ByteArray {
|
||||
setData(val);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(byte val[]) throws IllegalArgumentException {
|
||||
if (val == null)
|
||||
throw new NullPointerException("SessionTags cannot be null");
|
||||
|
@ -44,27 +44,32 @@ public class Signature extends DataStructureImpl {
|
||||
_data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_data = new byte[SIGNATURE_BYTES];
|
||||
int read = read(in, _data);
|
||||
if (read != SIGNATURE_BYTES) throw new DataFormatException("Not enough bytes to read the signature");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_data == null) throw new DataFormatException("No data in the signature to write out");
|
||||
if (_data.length != SIGNATURE_BYTES) throw new DataFormatException("Invalid size of data in the private key");
|
||||
out.write(_data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if ((obj == null) || !(obj instanceof Signature)) return false;
|
||||
return DataHelper.eq(_data, ((Signature) obj)._data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return DataHelper.hashCode(_data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer buf = new StringBuffer(64);
|
||||
buf.append("[Signature: ");
|
||||
|
@ -50,27 +50,32 @@ public class SigningPrivateKey extends DataStructureImpl {
|
||||
_data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_data = new byte[KEYSIZE_BYTES];
|
||||
int read = read(in, _data);
|
||||
if (read != KEYSIZE_BYTES) throw new DataFormatException("Not enough bytes to read the private key");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_data == null) throw new DataFormatException("No data in the private key to write out");
|
||||
if (_data.length != KEYSIZE_BYTES) throw new DataFormatException("Invalid size of data in the private key");
|
||||
out.write(_data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if ((obj == null) || !(obj instanceof SigningPrivateKey)) return false;
|
||||
return DataHelper.eq(_data, ((SigningPrivateKey) obj)._data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return DataHelper.hashCode(_data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer buf = new StringBuffer(64);
|
||||
buf.append("[SigningPrivateKey: ");
|
||||
|
@ -49,27 +49,32 @@ public class SigningPublicKey extends DataStructureImpl {
|
||||
_data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_data = new byte[KEYSIZE_BYTES];
|
||||
int read = read(in, _data);
|
||||
if (read != KEYSIZE_BYTES) throw new DataFormatException("Not enough bytes to read the public key");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_data == null) throw new DataFormatException("No data in the public key to write out");
|
||||
if (_data.length != KEYSIZE_BYTES) throw new DataFormatException("Invalid size of data in the public key");
|
||||
out.write(_data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if ((obj == null) || !(obj instanceof SigningPublicKey)) return false;
|
||||
return DataHelper.eq(_data, ((SigningPublicKey) obj)._data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return DataHelper.hashCode(_data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer buf = new StringBuffer(64);
|
||||
buf.append("[SigningPublicKey: ");
|
||||
|
@ -68,10 +68,12 @@ public class TunnelId extends DataStructureImpl {
|
||||
public int getType() { return _type; }
|
||||
public void setType(int type) { _type = type; }
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_tunnelId = DataHelper.readLong(in, 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_tunnelId < 0) throw new DataFormatException("Invalid tunnel ID: " + _tunnelId);
|
||||
DataHelper.writeLong(out, 4, _tunnelId);
|
||||
@ -82,15 +84,18 @@ public class TunnelId extends DataStructureImpl {
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if ( (obj == null) || !(obj instanceof TunnelId))
|
||||
return false;
|
||||
return getTunnelId() == ((TunnelId)obj).getTunnelId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (int)getTunnelId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() { return String.valueOf(getTunnelId()); }
|
||||
}
|
||||
|
@ -153,6 +153,7 @@ public class VerifiedDestination extends Destination {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer buf = new StringBuffer(128);
|
||||
buf.append(super.toString());
|
||||
|
Reference in New Issue
Block a user