drop 6 unused classes
This commit is contained in:
@ -1,64 +0,0 @@
|
||||
package net.i2p.data.i2np;
|
||||
/*
|
||||
* free (adj.): unencumbered; not under the control of others
|
||||
* Written by jrandom in 2003 and released into the public domain
|
||||
* with no warranty of any kind, either expressed or implied.
|
||||
* It probably won't make your computer catch on fire, or eat
|
||||
* your children, but it might. Use at your own risk.
|
||||
*
|
||||
*/
|
||||
|
||||
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.PrivateKey;
|
||||
import net.i2p.util.Log;
|
||||
|
||||
/**
|
||||
* Contains the private key which matches the EndPointPublicKey which, in turn,
|
||||
* is published on the LeaseSet and used to encrypt messages to the router to
|
||||
* which a Destination is currently connected.
|
||||
*
|
||||
* @author jrandom
|
||||
*/
|
||||
public class EndPointPrivateKey extends DataStructureImpl {
|
||||
private final static Log _log = new Log(EndPointPrivateKey.class);
|
||||
private PrivateKey _key;
|
||||
|
||||
public EndPointPrivateKey() { setKey(null); }
|
||||
|
||||
public PrivateKey getKey() { return _key; }
|
||||
public void setKey(PrivateKey key) { _key= key; }
|
||||
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_key = new PrivateKey();
|
||||
_key.readBytes(in);
|
||||
}
|
||||
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_key == null) throw new DataFormatException("Invalid key");
|
||||
_key.writeBytes(out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if ( (obj == null) || !(obj instanceof EndPointPublicKey))
|
||||
return false;
|
||||
return DataHelper.eq(getKey(), ((EndPointPublicKey)obj).getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
if (_key == null) return 0;
|
||||
return getKey().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[EndPointPrivateKey: " + getKey() + "]";
|
||||
}
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
package net.i2p.data.i2np;
|
||||
/*
|
||||
* free (adj.): unencumbered; not under the control of others
|
||||
* Written by jrandom in 2003 and released into the public domain
|
||||
* with no warranty of any kind, either expressed or implied.
|
||||
* It probably won't make your computer catch on fire, or eat
|
||||
* your children, but it might. Use at your own risk.
|
||||
*
|
||||
*/
|
||||
|
||||
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.PublicKey;
|
||||
import net.i2p.util.Log;
|
||||
|
||||
/**
|
||||
* Contains the public key which matches the EndPointPrivateKey. This is
|
||||
* published on the LeaseSet and used to encrypt messages to the router to
|
||||
* which a Destination is currently connected.
|
||||
*
|
||||
* @author jrandom
|
||||
*/
|
||||
public class EndPointPublicKey extends DataStructureImpl {
|
||||
private final static Log _log = new Log(EndPointPublicKey.class);
|
||||
private PublicKey _key;
|
||||
|
||||
public EndPointPublicKey() { setKey(null); }
|
||||
|
||||
public PublicKey getKey() { return _key; }
|
||||
public void setKey(PublicKey key) { _key= key; }
|
||||
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_key = new PublicKey();
|
||||
_key.readBytes(in);
|
||||
}
|
||||
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_key == null) throw new DataFormatException("Invalid key");
|
||||
_key.writeBytes(out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if ( (obj == null) || !(obj instanceof EndPointPublicKey))
|
||||
return false;
|
||||
return DataHelper.eq(getKey(), ((EndPointPublicKey)obj).getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
if (_key == null) return 0;
|
||||
return getKey().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[EndPointPublicKey: " + getKey() + "]";
|
||||
}
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
package net.i2p.data.i2np;
|
||||
/*
|
||||
* free (adj.): unencumbered; not under the control of others
|
||||
* Written by jrandom in 2003 and released into the public domain
|
||||
* with no warranty of any kind, either expressed or implied.
|
||||
* It probably won't make your computer catch on fire, or eat
|
||||
* your children, but it might. Use at your own risk.
|
||||
*
|
||||
*/
|
||||
|
||||
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.SessionKey;
|
||||
import net.i2p.util.Log;
|
||||
|
||||
/**
|
||||
* Contains the session key used by the tunnel gateway to encrypt the DeliveryInstructions
|
||||
* and used by the tunnel end point to decrypt those instructions.
|
||||
*
|
||||
* @author jrandom
|
||||
*/
|
||||
public class TunnelSessionKey extends DataStructureImpl {
|
||||
private final static Log _log = new Log(TunnelSessionKey.class);
|
||||
private SessionKey _key;
|
||||
|
||||
public TunnelSessionKey() { this(null); }
|
||||
public TunnelSessionKey(SessionKey key) { setKey(key); }
|
||||
|
||||
public SessionKey getKey() { return _key; }
|
||||
public void setKey(SessionKey key) { _key= key; }
|
||||
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_key = new SessionKey();
|
||||
_key.readBytes(in);
|
||||
}
|
||||
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_key == null) throw new DataFormatException("Invalid key");
|
||||
_key.writeBytes(out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if ( (obj == null) || !(obj instanceof TunnelSessionKey))
|
||||
return false;
|
||||
return DataHelper.eq(getKey(), ((TunnelSessionKey)obj).getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
if (_key == null) return 0;
|
||||
return getKey().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[TunnelSessionKey: " + getKey() + "]";
|
||||
}
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
package net.i2p.data.i2np;
|
||||
/*
|
||||
* free (adj.): unencumbered; not under the control of others
|
||||
* Written by jrandom in 2003 and released into the public domain
|
||||
* with no warranty of any kind, either expressed or implied.
|
||||
* It probably won't make your computer catch on fire, or eat
|
||||
* your children, but it might. Use at your own risk.
|
||||
*
|
||||
*/
|
||||
|
||||
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.SigningPrivateKey;
|
||||
import net.i2p.util.Log;
|
||||
|
||||
/**
|
||||
* Contains the private key which constructs a signature for the TunnelMessage
|
||||
* which every participant in a tunnel uses to verify the
|
||||
* TunnelVerificationStructure with.
|
||||
*
|
||||
* @author jrandom
|
||||
*/
|
||||
public class TunnelSigningPrivateKey extends DataStructureImpl {
|
||||
private final static Log _log = new Log(EndPointPrivateKey.class);
|
||||
private SigningPrivateKey _key;
|
||||
|
||||
public TunnelSigningPrivateKey() { this(null); }
|
||||
public TunnelSigningPrivateKey(SigningPrivateKey key) { setKey(key); }
|
||||
|
||||
public SigningPrivateKey getKey() { return _key; }
|
||||
public void setKey(SigningPrivateKey key) { _key= key; }
|
||||
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_key = new SigningPrivateKey();
|
||||
_key.readBytes(in);
|
||||
}
|
||||
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_key == null) throw new DataFormatException("Invalid key");
|
||||
_key.writeBytes(out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if ( (obj == null) || !(obj instanceof TunnelSigningPrivateKey))
|
||||
return false;
|
||||
return DataHelper.eq(getKey(), ((TunnelSigningPrivateKey)obj).getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
if (_key == null) return 0;
|
||||
return getKey().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[EndPointPrivateKey: " + getKey() + "]";
|
||||
}
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
package net.i2p.data.i2np;
|
||||
/*
|
||||
* free (adj.): unencumbered; not under the control of others
|
||||
* Written by jrandom in 2003 and released into the public domain
|
||||
* with no warranty of any kind, either expressed or implied.
|
||||
* It probably won't make your computer catch on fire, or eat
|
||||
* your children, but it might. Use at your own risk.
|
||||
*
|
||||
*/
|
||||
|
||||
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.SigningPublicKey;
|
||||
import net.i2p.util.Log;
|
||||
|
||||
/**
|
||||
* Contains the public key which every participant in a tunnel uses to verify
|
||||
* the TunnelVerificationStructure for TunnelMessages that pass by.
|
||||
*
|
||||
* @author jrandom
|
||||
*/
|
||||
public class TunnelSigningPublicKey extends DataStructureImpl {
|
||||
private final static Log _log = new Log(TunnelSigningPublicKey.class);
|
||||
private SigningPublicKey _key;
|
||||
|
||||
public TunnelSigningPublicKey() { this(null); }
|
||||
public TunnelSigningPublicKey(SigningPublicKey key) { setKey(key); }
|
||||
|
||||
public SigningPublicKey getKey() { return _key; }
|
||||
public void setKey(SigningPublicKey key) { _key= key; }
|
||||
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_key = new SigningPublicKey();
|
||||
_key.readBytes(in);
|
||||
}
|
||||
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_key == null) throw new DataFormatException("Invalid key");
|
||||
_key.writeBytes(out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if ( (obj == null) || !(obj instanceof TunnelSigningPublicKey))
|
||||
return false;
|
||||
return DataHelper.eq(getKey(), ((TunnelSigningPublicKey)obj).getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
if (_key == null) return 0;
|
||||
return getKey().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[TunnelSigningPublicKey: " + getKey() + "]";
|
||||
}
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
package net.i2p.data.i2np;
|
||||
/*
|
||||
* free (adj.): unencumbered; not under the control of others
|
||||
* Written by jrandom in 2003 and released into the public domain
|
||||
* with no warranty of any kind, either expressed or implied.
|
||||
* It probably won't make your computer catch on fire, or eat
|
||||
* your children, but it might. Use at your own risk.
|
||||
*
|
||||
*/
|
||||
|
||||
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.Hash;
|
||||
import net.i2p.data.Signature;
|
||||
import net.i2p.data.SigningPrivateKey;
|
||||
import net.i2p.data.SigningPublicKey;
|
||||
import net.i2p.router.RouterContext;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jrandom
|
||||
*/
|
||||
public class TunnelVerificationStructure extends DataStructureImpl {
|
||||
private Hash _msgHash;
|
||||
private Signature _authSignature;
|
||||
|
||||
public TunnelVerificationStructure() { this(null, null); }
|
||||
public TunnelVerificationStructure(Hash messageHash, Signature authSig) {
|
||||
setMessageHash(messageHash);
|
||||
setAuthorizationSignature(authSig);
|
||||
}
|
||||
|
||||
public Hash getMessageHash() { return _msgHash; }
|
||||
public void setMessageHash(Hash hash) { _msgHash = hash; }
|
||||
|
||||
public Signature getAuthorizationSignature() { return _authSignature; }
|
||||
public void setAuthorizationSignature(Signature sig) { _authSignature = sig; }
|
||||
|
||||
public void sign(RouterContext context, SigningPrivateKey key) {
|
||||
if (_msgHash != null) {
|
||||
Signature sig = context.dsa().sign(_msgHash.getData(), key);
|
||||
setAuthorizationSignature(sig);
|
||||
}
|
||||
}
|
||||
public boolean verifySignature(RouterContext context, SigningPublicKey key) {
|
||||
if (_msgHash == null) return false;
|
||||
return context.dsa().verifySignature(_authSignature, _msgHash.getData(), key);
|
||||
}
|
||||
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_msgHash = new Hash();
|
||||
_msgHash.readBytes(in);
|
||||
_authSignature = new Signature();
|
||||
_authSignature.readBytes(in);
|
||||
}
|
||||
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_authSignature == null) {
|
||||
_authSignature = new Signature();
|
||||
_authSignature.setData(Signature.FAKE_SIGNATURE);
|
||||
}
|
||||
if ( (_msgHash == null) || (_authSignature == null) ) throw new DataFormatException("Invalid data");
|
||||
_msgHash.writeBytes(out);
|
||||
_authSignature.writeBytes(out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if ( (obj == null) || !(obj instanceof TunnelVerificationStructure))
|
||||
return false;
|
||||
TunnelVerificationStructure str = (TunnelVerificationStructure)obj;
|
||||
return DataHelper.eq(getMessageHash(), str.getMessageHash()) &&
|
||||
DataHelper.eq(getAuthorizationSignature(), str.getAuthorizationSignature());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
if ( (_msgHash == null) || (_authSignature == null) ) return 0;
|
||||
return getMessageHash().hashCode() + getAuthorizationSignature().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[TunnelVerificationStructure: " + getMessageHash() + " " + getAuthorizationSignature() + "]";
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user