Record Class Grease

java.lang.Object
java.lang.Record
io.github.mahmoudimus.quic.tls.Grease
Record Components:
cipher - the GREASE cipher suite
group - the GREASE named group, in supported_groups and key_share
extension1 - the type of the first GREASE extension
extension2 - the type of the last GREASE extension
version - the GREASE version in supported_versions
signature - the GREASE signature scheme in signature_algorithms

public record Grease(int cipher, int group, int extension1, int extension2, int version, int signature) extends Record
The GREASE values (RFC 8701) one ClientHello uses, drawn per connection the way BoringSSL draws them: one for the cipher suites, one shared by the supported groups and the key shares, one for each of the two GREASE extensions (which must differ), one for the supported versions and one for the signature algorithms.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Grease(int cipher, int group, int extension1, int extension2, int version, int signature)
    Creates an instance of a Grease record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the value of the cipher record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    int
    Returns the value of the extension1 record component.
    int
    Returns the value of the extension2 record component.
    int
    Returns the value of the group record component.
    final int
    Returns a hash code value for this object.
    static boolean
    isGrease(int value)
    Whether value is one of the sixteen GREASE values, 0x0a0a to 0xfafa.
    static Grease
    Draws a hello's values from random.
    int
    Returns the value of the signature record component.
    final String
    Returns a string representation of this record class.
    int
    Returns the value of the version record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Grease

      public Grease(int cipher, int group, int extension1, int extension2, int version, int signature)
      Creates an instance of a Grease record class.
      Parameters:
      cipher - the value for the cipher record component
      group - the value for the group record component
      extension1 - the value for the extension1 record component
      extension2 - the value for the extension2 record component
      version - the value for the version record component
      signature - the value for the signature record component
  • Method Details

    • random

      public static Grease random(RandomGenerator random)
      Draws a hello's values from random.
      Parameters:
      random - the source of randomness
      Returns:
      the values, with extension1 != extension2
    • isGrease

      public static boolean isGrease(int value)
      Whether value is one of the sixteen GREASE values, 0x0a0a to 0xfafa.
      Parameters:
      value - a cipher suite, group, extension type, version or signature scheme
      Returns:
      whether it is reserved for GREASE
    • 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 '=='.
      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.
    • cipher

      public int cipher()
      Returns the value of the cipher record component.
      Returns:
      the value of the cipher record component
    • group

      public int group()
      Returns the value of the group record component.
      Returns:
      the value of the group record component
    • extension1

      public int extension1()
      Returns the value of the extension1 record component.
      Returns:
      the value of the extension1 record component
    • extension2

      public int extension2()
      Returns the value of the extension2 record component.
      Returns:
      the value of the extension2 record component
    • version

      public int version()
      Returns the value of the version record component.
      Returns:
      the value of the version record component
    • signature

      public int signature()
      Returns the value of the signature record component.
      Returns:
      the value of the signature record component