Record Class AesKeyGenSpec

java.lang.Object
java.lang.Record
zeroecho.core.alg.aes.AesKeyGenSpec
Record Components:
keySizeBits - the AES key size in bits (128, 192, or 256)
All Implemented Interfaces:
Describable, AlgorithmKeySpec

public record AesKeyGenSpec(int keySizeBits) extends Record implements AlgorithmKeySpec, Describable
Key generation parameters for AES.

Instances of this record specify the size of an AES key in bits. Valid values are 128, 192, and 256. A AesKeyGenSpec is consumed by the registered AES key builder to create a new SecretKey.

Objects of this type are immutable and thread-safe.

Since:
1.0
  • Constructor Details

    • AesKeyGenSpec

      public AesKeyGenSpec(int keySizeBits)
      Creates a new spec and validates the key size.
      Throws:
      IllegalArgumentException - if keySizeBits is not one of 128, 192, or 256
  • Method Details

    • aes128

      public static AesKeyGenSpec aes128()
      Constructs a spec for generating a 128-bit AES key.
      Returns:
      a specification for AES-128
    • aes192

      public static AesKeyGenSpec aes192()
      Constructs a spec for generating a 192-bit AES key.
      Returns:
      a specification for AES-192
    • aes256

      public static AesKeyGenSpec aes256()
      Constructs a spec for generating a 256-bit AES key.
      Returns:
      a specification for AES-256
    • description

      public String description()
      Provides a short textual description of the key size. For example, "256bits".
      Specified by:
      description in interface Describable
      Returns:
      a human-readable description
    • 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 the compare method from their corresponding wrapper classes.
      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.
    • keySizeBits

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