Enum Class CipherSuite

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

public enum CipherSuite extends Enum<CipherSuite>
The TLS 1.3 cipher suites QUIC can use (RFC 9001 section 5.3), with what packet protection needs to know about each: its HKDF hash, AEAD and key length.
  • Enum Constant Details

    • TLS_AES_128_GCM_SHA256

      public static final CipherSuite TLS_AES_128_GCM_SHA256
      TLS_AES_128_GCM_SHA256, also used for Initial packets.
    • TLS_AES_256_GCM_SHA384

      public static final CipherSuite TLS_AES_256_GCM_SHA384
      TLS_AES_256_GCM_SHA384.
    • TLS_CHACHA20_POLY1305_SHA256

      public static final CipherSuite TLS_CHACHA20_POLY1305_SHA256
      TLS_CHACHA20_POLY1305_SHA256.
  • Method Details

    • values

      public static CipherSuite[] 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 CipherSuite 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
    • code

      public int code()
      The suite's TLS code point.
      Returns:
      the two-byte code, such as 0x1301
    • hkdf

      public Hkdf hkdf()
      The HKDF over the suite's hash.
      Returns:
      the HKDF
    • aead

      public String aead()
      The JCA transformation of the suite's AEAD.
      Returns:
      "AES/GCM/NoPadding" or "ChaCha20-Poly1305"
    • keyLength

      public int keyLength()
      The AEAD key length, which is also the header protection key length.
      Returns:
      the key length in bytes
    • aes

      public boolean aes()
      Whether header protection uses AES (as opposed to ChaCha20).
      Returns:
      true for the AES-GCM suites
    • forCode

      public static CipherSuite forCode(int code)
      The suite with a TLS code point.
      Parameters:
      code - the code point
      Returns:
      the suite, or null if QUIC cannot use it