Enum Class QuicVersion

java.lang.Object
java.lang.Enum<QuicVersion>
io.github.mahmoudimus.quic.QuicVersion
All Implemented Interfaces:
Serializable, Comparable<QuicVersion>, Constable

public enum QuicVersion extends Enum<QuicVersion>
The QUIC versions this module speaks: version 1 (RFC 9000) and version 2 (RFC 9369). They differ only in the version number, the long header packet type bits, the Initial salt, the HKDF labels and the Retry integrity key.

Instances are immutable; the byte-array accessors return copies.

  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    QUIC version 1, 0x00000001 (RFC 9000).
    QUIC version 2, 0x6b3343cf (RFC 9369).
  • Method Summary

    Modifier and Type
    Method
    Description
    forWireValue(int wireValue)
    The version with a wire number.
    The HKDF label for the header protection key: "quic hp" or "quicv2 hp".
    byte[]
    The salt that derives Initial secrets from the client's first Destination Connection ID (RFC 9001 section 5.2, RFC 9369 section 3.3.1).
    static boolean
    isReserved(int wireValue)
    Whether a version number is reserved for exercising version negotiation, that is, matches 0x?a?a?a?a (RFC 9000 section 15).
    The HKDF label for the AEAD IV: "quic iv" or "quicv2 iv".
    The HKDF label for the AEAD key: "quic key" or "quicv2 key".
    The HKDF label for the next secret of a key update: "quic ku" or "quicv2 ku".
    byte[]
    The fixed AES-128-GCM key of the Retry integrity tag (RFC 9001 section 5.8).
    byte[]
    The fixed nonce of the Retry integrity tag (RFC 9001 section 5.8).
    Returns the enum constant of this class with the specified name.
    static QuicVersion[]
    Returns an array containing the constants of this enum class, in the order they are declared.
    int
    The 32-bit version number as it appears in long headers.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • V1

      public static final QuicVersion V1
      QUIC version 1, 0x00000001 (RFC 9000).
    • V2

      public static final QuicVersion V2
      QUIC version 2, 0x6b3343cf (RFC 9369).
  • Method Details

    • values

      public static QuicVersion[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static QuicVersion valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • wireValue

      public int wireValue()
      The 32-bit version number as it appears in long headers.
      Returns:
      the version number
    • initialSalt

      public byte[] initialSalt()
      The salt that derives Initial secrets from the client's first Destination Connection ID (RFC 9001 section 5.2, RFC 9369 section 3.3.1).
      Returns:
      a copy of the 20-byte salt
    • keyLabel

      public String keyLabel()
      The HKDF label for the AEAD key: "quic key" or "quicv2 key".
      Returns:
      the label, without the TLS "tls13 " prefix
    • ivLabel

      public String ivLabel()
      The HKDF label for the AEAD IV: "quic iv" or "quicv2 iv".
      Returns:
      the label, without the TLS "tls13 " prefix
    • headerProtectionLabel

      public String headerProtectionLabel()
      The HKDF label for the header protection key: "quic hp" or "quicv2 hp".
      Returns:
      the label, without the TLS "tls13 " prefix
    • keyUpdateLabel

      public String keyUpdateLabel()
      The HKDF label for the next secret of a key update: "quic ku" or "quicv2 ku".
      Returns:
      the label, without the TLS "tls13 " prefix
    • retryIntegrityKey

      public byte[] retryIntegrityKey()
      The fixed AES-128-GCM key of the Retry integrity tag (RFC 9001 section 5.8).
      Returns:
      a copy of the 16-byte key
    • retryIntegrityNonce

      public byte[] retryIntegrityNonce()
      The fixed nonce of the Retry integrity tag (RFC 9001 section 5.8).
      Returns:
      a copy of the 12-byte nonce
    • forWireValue

      public static QuicVersion forWireValue(int wireValue)
      The version with a wire number.
      Parameters:
      wireValue - the 32-bit version number
      Returns:
      the version, or null if this module does not speak it
    • isReserved

      public static boolean isReserved(int wireValue)
      Whether a version number is reserved for exercising version negotiation, that is, matches 0x?a?a?a?a (RFC 9000 section 15).
      Parameters:
      wireValue - the 32-bit version number
      Returns:
      true for a reserved (GREASE) version