Class SessionConfig

    • Constructor Detail

      • SessionConfig

        public SessionConfig()
      • SessionConfig

        public SessionConfig​(Destination dest)
    • Method Detail

      • getDestination

        public Destination getDestination()
        Retrieve the destination for which this session is supposed to connect
        Returns:
        Destination for this session
      • getCreationDate

        public Date getCreationDate()
        Determine when this session was authorized by the destination (so we can prevent replay attacks)
        Returns:
        Date
      • setCreationDate

        public void setCreationDate​(Date date)
      • getOptions

        public Properties getOptions()
        Retrieve any configuration options for the session
        Returns:
        Properties of this session
      • setOptions

        public void setOptions​(Properties options)
        Configure the session with the given options; keys and values 255 bytes (not chars) max each Defaults in SessionConfig options are, in general, NOT honored. Defaults are not serialized out-of-JVM, and the router does not recognize defaults in-JVM. Client side must promote defaults to the primary map.
        Parameters:
        options - Properties for this session
      • getSignature

        public Signature getSignature()
      • setSignature

        public void setSignature​(Signature sig)
      • verifySignature

        public boolean verifySignature()
        Verify that the signature matches the destination's signing public key. Note that this also returns false if the creation date is too far in the past or future. See tooOld() and getCreationDate().
        Returns:
        true only if the signature matches
      • tooOld

        public boolean tooOld()
        Misnamed, could be too old or too far in the future.
      • readBytes

        public void readBytes​(InputStream rawConfig)
                       throws DataFormatException,
                              IOException
        Description copied from interface: DataStructure
        Load up the current object with data from the given stream. Data loaded this way must match the I2P data structure specification. Warning - many classes will throw IllegalStateException if data is already set.
        Parameters:
        rawConfig - stream to read from
        Throws:
        DataFormatException - if the data is improperly formatted
        IOException - if there was a problem reading the stream
      • writeBytes

        public void writeBytes​(OutputStream out)
                        throws DataFormatException,
                               IOException
        Description copied from interface: DataStructure
        Write out the data structure to the stream, using the format defined in the I2P data structure specification.
        Parameters:
        out - stream to write to
        Throws:
        DataFormatException - if the data was incomplete or not yet ready to be written
        IOException - if there was a problem writing to the stream
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object