From e1a88c94263f206126deb81f33e387570b2b4cd5 Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Sun, 6 Dec 2009 15:07:03 +0000 Subject: [PATCH] drop 6 unused classes --- .../net/i2p/data/i2np/EndPointPrivateKey.java | 64 ------------- .../net/i2p/data/i2np/EndPointPublicKey.java | 64 ------------- .../net/i2p/data/i2np/TunnelSessionKey.java | 64 ------------- .../data/i2np/TunnelSigningPrivateKey.java | 65 ------------- .../i2p/data/i2np/TunnelSigningPublicKey.java | 64 ------------- .../i2np/TunnelVerificationStructure.java | 91 ------------------- 6 files changed, 412 deletions(-) delete mode 100644 router/java/src/net/i2p/data/i2np/EndPointPrivateKey.java delete mode 100644 router/java/src/net/i2p/data/i2np/EndPointPublicKey.java delete mode 100644 router/java/src/net/i2p/data/i2np/TunnelSessionKey.java delete mode 100644 router/java/src/net/i2p/data/i2np/TunnelSigningPrivateKey.java delete mode 100644 router/java/src/net/i2p/data/i2np/TunnelSigningPublicKey.java delete mode 100644 router/java/src/net/i2p/data/i2np/TunnelVerificationStructure.java diff --git a/router/java/src/net/i2p/data/i2np/EndPointPrivateKey.java b/router/java/src/net/i2p/data/i2np/EndPointPrivateKey.java deleted file mode 100644 index 4b3f919c84..0000000000 --- a/router/java/src/net/i2p/data/i2np/EndPointPrivateKey.java +++ /dev/null @@ -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() + "]"; - } -} diff --git a/router/java/src/net/i2p/data/i2np/EndPointPublicKey.java b/router/java/src/net/i2p/data/i2np/EndPointPublicKey.java deleted file mode 100644 index a366bf73bf..0000000000 --- a/router/java/src/net/i2p/data/i2np/EndPointPublicKey.java +++ /dev/null @@ -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() + "]"; - } -} diff --git a/router/java/src/net/i2p/data/i2np/TunnelSessionKey.java b/router/java/src/net/i2p/data/i2np/TunnelSessionKey.java deleted file mode 100644 index c4effc3034..0000000000 --- a/router/java/src/net/i2p/data/i2np/TunnelSessionKey.java +++ /dev/null @@ -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() + "]"; - } -} diff --git a/router/java/src/net/i2p/data/i2np/TunnelSigningPrivateKey.java b/router/java/src/net/i2p/data/i2np/TunnelSigningPrivateKey.java deleted file mode 100644 index 03d017915f..0000000000 --- a/router/java/src/net/i2p/data/i2np/TunnelSigningPrivateKey.java +++ /dev/null @@ -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() + "]"; - } -} diff --git a/router/java/src/net/i2p/data/i2np/TunnelSigningPublicKey.java b/router/java/src/net/i2p/data/i2np/TunnelSigningPublicKey.java deleted file mode 100644 index 1f35309492..0000000000 --- a/router/java/src/net/i2p/data/i2np/TunnelSigningPublicKey.java +++ /dev/null @@ -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() + "]"; - } -} diff --git a/router/java/src/net/i2p/data/i2np/TunnelVerificationStructure.java b/router/java/src/net/i2p/data/i2np/TunnelVerificationStructure.java deleted file mode 100644 index 7c2e4f0016..0000000000 --- a/router/java/src/net/i2p/data/i2np/TunnelVerificationStructure.java +++ /dev/null @@ -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() + "]"; - } -} -- GitLab