Package net.i2p.data
Class Destination
- java.lang.Object
-
- net.i2p.data.DataStructureImpl
-
- net.i2p.data.KeysAndCert
-
- net.i2p.data.Destination
-
- All Implemented Interfaces:
Serializable
,DataStructure
- Direct Known Subclasses:
VerifiedDestination
public class Destination extends KeysAndCert
Defines an end point in the I2P network. The Destination may move around in the network, but messages sent to the Destination will find it Note that the public (encryption) key is essentially unused, since "end-to-end" encryption was removed in 0.6. The public key in the LeaseSet is used instead. The first bytes of the public key are used for the IV for leaseset encryption, but that encryption is poorly designed and should be deprecated. As of 0.9.9 this data structure is immutable after the two keys and the certificate are set; attempts to change them will throw an IllegalStateException.- Author:
- jrandom
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class net.i2p.data.KeysAndCert
_certificate, _padding, _publicKey, _signingKey
-
-
Constructor Summary
Constructors Constructor Description Destination()
Destination(String s)
alternative constructor which takes a base64 string representation
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static void
clearCache()
Clear the cache.static Destination
create(InputStream in)
Pull from cache or return newboolean
equals(Object o)
int
hashCode()
the signing key has enough randomness in it to use it by itself for speedint
readBytes(byte[] source, int offset)
Deprecated.int
size()
String
toBase32()
For convenience.String
toBase64()
Cache it.int
writeBytes(byte[] target, int offset)
Deprecated, used only by Packet.java in streaming.-
Methods inherited from class net.i2p.data.KeysAndCert
calculateHash, combinePadding, getCertificate, getEncType, getHash, getPadding, getPublicKey, getSigningPublicKey, getSigType, readBytes, setCertificate, setPadding, setPublicKey, setSigningPublicKey, toString, writeBytes
-
Methods inherited from class net.i2p.data.DataStructureImpl
fromBase64, fromByteArray, read, toByteArray
-
-
-
-
Constructor Detail
-
Destination
public Destination()
-
Destination
public Destination(String s) throws DataFormatException
alternative constructor which takes a base64 string representation- Parameters:
s
- a Base64 representation of the destination, as (eg) is used in hosts.txt- Throws:
DataFormatException
-
-
Method Detail
-
create
public static Destination create(InputStream in) throws DataFormatException, IOException
Pull from cache or return new- Throws:
DataFormatException
IOException
- Since:
- 0.9.9
-
writeBytes
public int writeBytes(byte[] target, int offset)
Deprecated, used only by Packet.java in streaming. Broken for sig types P521 and RSA before 0.9.15- Returns:
- the written length (NOT the new offset)
-
readBytes
@Deprecated public int readBytes(byte[] source, int offset) throws DataFormatException
Deprecated.deprecated was used only by Packet.java in streaming, now unused Warning - used by i2p-bote. Does NOT support alternate key types. DSA-SHA1 only.- Throws:
IllegalStateException
- if data already setDataFormatException
-
size
public int size()
-
toBase64
public String toBase64()
Cache it. Useful in I2PTunnelHTTPServer where it is added to the headers- Specified by:
toBase64
in interfaceDataStructure
- Overrides:
toBase64
in classDataStructureImpl
- Returns:
- null on error
- Since:
- 0.9.9
-
toBase32
public String toBase32()
For convenience.- Returns:
- "{52 chars}.b32.i2p" or null if fields not set.
- Since:
- 0.9.14
-
clearCache
public static void clearCache()
Clear the cache.- Since:
- 0.9.9
-
equals
public boolean equals(Object o)
- Overrides:
equals
in classKeysAndCert
-
hashCode
public int hashCode()
Description copied from class:KeysAndCert
the signing key has enough randomness in it to use it by itself for speed- Overrides:
hashCode
in classKeysAndCert
-
-