Record Class DirectionalKeys

java.lang.Object
java.lang.Record
io.github.mahmoudimus.quic.crypto.DirectionalKeys
Record Components:
header - the header protection key
packet - the payload key

public record DirectionalKeys(HeaderKey header, PacketKey packet) extends Record
The keys that protect packets in one direction at one encryption level: a header protection key and a packet (payload) key. Like its parts, an instance is confined to one thread at a time.
  • Constructor Details

    • DirectionalKeys

      public DirectionalKeys(HeaderKey header, PacketKey packet)
      Keys from their parts.
      Parameters:
      header - the header protection key
      packet - the payload key
  • Method Details

    • fromSecret

      public static DirectionalKeys fromSecret(CipherSuite suite, byte[] secret, QuicVersion version)
      Derives both keys from one traffic secret (RFC 9001 section 5.1).
      Parameters:
      suite - the cipher suite the secret belongs to
      secret - the traffic secret
      version - the QUIC version, which picks the HKDF labels
      Returns:
      the keys
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • header

      public HeaderKey header()
      Returns the value of the header record component.
      Returns:
      the value of the header record component
    • packet

      public PacketKey packet()
      Returns the value of the packet record component.
      Returns:
      the value of the packet record component