Package net.i2p.data

Class 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:
  • Constructor Details

    • 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 Details

    • 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 set
      DataFormatException
    • size

      public int size()
    • toBase64

      public String toBase64()
      Cache it. Useful in I2PTunnelHTTPServer where it is added to the headers
      Specified by:
      toBase64 in interface DataStructure
      Overrides:
      toBase64 in class DataStructureImpl
      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 class KeysAndCert
    • 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 class KeysAndCert