Package io.github.mahmoudimus.quic
Enum Class QuicVersion
- All Implemented Interfaces:
Serializable,Comparable<QuicVersion>,Constable
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 -
Method Summary
Modifier and TypeMethodDescriptionstatic QuicVersionforWireValue(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 booleanisReserved(int wireValue) Whether a version number is reserved for exercising version negotiation, that is, matches0x?a?a?a?a(RFC 9000 section 15).ivLabel()The HKDF label for the AEAD IV:"quic iv"or"quicv2 iv".keyLabel()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).static QuicVersionReturns the enum constant of this class with the specified name.static QuicVersion[]values()Returns an array containing the constants of this enum class, in the order they are declared.intThe 32-bit version number as it appears in long headers.
-
Enum Constant Details
-
V1
QUIC version 1,0x00000001(RFC 9000). -
V2
QUIC version 2,0x6b3343cf(RFC 9369).
-
-
Method Details
-
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
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 nameNullPointerException- 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
The HKDF label for the AEAD key:"quic key"or"quicv2 key".- Returns:
- the label, without the TLS
"tls13 "prefix
-
ivLabel
The HKDF label for the AEAD IV:"quic iv"or"quicv2 iv".- Returns:
- the label, without the TLS
"tls13 "prefix
-
headerProtectionLabel
The HKDF label for the header protection key:"quic hp"or"quicv2 hp".- Returns:
- the label, without the TLS
"tls13 "prefix
-
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
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, matches0x?a?a?a?a(RFC 9000 section 15).- Parameters:
wireValue- the 32-bit version number- Returns:
- true for a reserved (GREASE) version
-