All Implemented Interfaces:
DataStructure

class NextSessionKeyextends PublicKey
X25519 public key with identifier for next session key exchange in ratchet protocol.
  • Field Details

    • _id

      private final int _id
      Which key in the sequence this one is.
    • _isReverse

      private final boolean _isReverse
      True for the key sent by the other side.
    • _isRequest

      private final boolean _isRequest
      True when this key is asked for, not offered.
  • Constructor Details

    • NextSessionKey

      public NextSessionKey(byte[] data, int id, boolean isReverse, boolean isRequest)
      Create a NextSessionKey from raw key data.
      Parameters:
      data - non-null
      id - the session identifier
      isReverse - whether this is a reverse session
      isRequest - whether this is a request
    • NextSessionKey

      public NextSessionKey(int id, boolean isReverse, boolean isRequest)
      Create a NextSessionKey with null data, for acks/requests only. Type will be ElG but doesn't matter. Don't call setData().
      Parameters:
      id - the session identifier
      isReverse - whether this is a reverse session
      isRequest - whether this is a request
  • Method Details

    • getID

      public int getID()
      Which key in the sequence this one is.
      Returns:
      the id as carried on the wire, 0-65535
    • isReverse

      public boolean isReverse()
      Whether this is a reverse session.
      Returns:
      true if this is a reverse session
    • isRequest

      public boolean isRequest()
      Whether this is a request.
      Returns:
      true if this is a request
    • hashCode

      public int hashCode()
      Hash code combining the id with the reverse and request flags.
      Overrides:
      hashCode in class PublicKey
      Returns:
      the hash code
    • equals

      public boolean equals(Object obj)
      Equal if the ratchet and message number match.
      Overrides:
      equals in class PublicKey
      Parameters:
      obj - the object to compare
      Returns:
      true if the data arrays are equal
    • toString

      public String toString()
      Description copied from class: PublicKey
      String representation showing type and data size.
      Overrides:
      toString in class PublicKey