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 Summary
ConstructorsConstructorDescriptionAesKeyGenSpec(int keySizeBits) Creates a new spec and validates the key size. -
Method Summary
Modifier and TypeMethodDescriptionstatic AesKeyGenSpecaes128()Constructs a spec for generating a 128-bit AES key.static AesKeyGenSpecaes192()Constructs a spec for generating a 192-bit AES key.static AesKeyGenSpecaes256()Constructs a spec for generating a 256-bit AES key.Provides a short textual description of the key size.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of thekeySizeBitsrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
AesKeyGenSpec
public AesKeyGenSpec(int keySizeBits) Creates a new spec and validates the key size.- Throws:
IllegalArgumentException- ifkeySizeBitsis not one of 128, 192, or 256
-
-
Method Details
-
aes128
Constructs a spec for generating a 128-bit AES key.- Returns:
- a specification for AES-128
-
aes192
Constructs a spec for generating a 192-bit AES key.- Returns:
- a specification for AES-192
-
aes256
Constructs a spec for generating a 256-bit AES key.- Returns:
- a specification for AES-256
-
description
Provides a short textual description of the key size. For example,"256bits".- Specified by:
descriptionin interfaceDescribable- Returns:
- a human-readable description
-
toString
-
hashCode
-
equals
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 thecomparemethod from their corresponding wrapper classes. -
keySizeBits
public int keySizeBits()Returns the value of thekeySizeBitsrecord component.- Returns:
- the value of the
keySizeBitsrecord component
-