Record Class SecurityLevel
java.lang.Object
java.lang.Record
zeroecho.core.SecurityLevel
- Record Components:
nistLevel- optional NIST security category, from 1 to 5classicalBits- positive classical security strength in bits
Security level of a cryptographic algorithm or parameter set.
Dual representation supports both classical and NIST PQC levels:
nistLevel()— NIST PQC security category (1–5), or empty for classical-only algorithms.classicalBits()— equivalent classical security in bits (e.g., 128, 192, 256).
Construction
classical(int)— classical algorithms (RSA, AES, ECDSA …) where no NIST PQC category applies.nist(int, int)— post-quantum parameter sets with a defined NIST category.
NIST PQC categories
Level 1 ≈ 128-bit classical (AES-128 search) Level 2 ≈ 128-bit (stronger collision requirement) Level 3 ≈ 192-bit classical (AES-192 search) Level 4 ≈ 192-bit (stronger collision requirement) Level 5 ≈ 256-bit classical (AES-256 search)
- Since:
- 1.0
-
Constructor Summary
ConstructorsConstructorDescriptionSecurityLevel(OptionalInt nistLevel, int classicalBits) Validates the record fields on construction. -
Method Summary
Modifier and TypeMethodDescriptionstatic SecurityLevelclassical(int bits) Creates a classical-only security level with no NIST PQC category.intReturns the value of theclassicalBitsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static SecurityLevelnist(int nistCategory, int classicalBits) Creates a post-quantum security level with a NIST PQC category.Returns the value of thenistLevelrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
SecurityLevel
Validates the record fields on construction.- Throws:
NullPointerException- ifnistLevelisnullIllegalArgumentException- ifclassicalBitsis not positive, or if a NIST level is present but not in [1, 5]
-
-
Method Details
-
classical
Creates a classical-only security level with no NIST PQC category.- Parameters:
bits- classical security strength in bits (must be positive)- Returns:
- a
SecurityLevelwith an emptynistLevel
-
nist
Creates a post-quantum security level with a NIST PQC category.- Parameters:
nistCategory- NIST security category (1–5)classicalBits- equivalent classical security in bits (must be positive)- Returns:
- a
SecurityLevelwith the given NIST category
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
nistLevel
-
classicalBits
public int classicalBits()Returns the value of theclassicalBitsrecord component.- Returns:
- the value of the
classicalBitsrecord component
-