Package com.digicert.validation.random
Class RandomValueVerifier
java.lang.Object
com.digicert.validation.random.RandomValueVerifier
Verifies the validity and entropy of random values.
This class ensures that random values meet the required entropy and are within the validity period.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
BR version 1.3.8 requires 112 bits of entropyprivate final double
Calculate and cache the entropy per character in the constructor to save time when validating random valuesprivate final int
Default validity period for random value is 30 days -
Constructor Summary
ConstructorsConstructorDescriptionRandomValueVerifier
(DcvContext dcvContext) Constructs a new RandomValueVerifier with the specified configuration. -
Method Summary
Modifier and TypeMethodDescriptionprivate double
calculatePerCharacterEntropy
(RandomValueGenerator randomValueGenerator) Calculates the entropy per character for the given random value generator.private boolean
isEntropySufficient
(String randomValue) Checks if the given random value has sufficient entropy.void
verifyRandomValue
(String randomValue, Instant prepareTime) Verifies the given random value for validity and entropy.
-
Field Details
-
MIN_ALLOWED_ENTROPY_VALUE
private static final int MIN_ALLOWED_ENTROPY_VALUEBR version 1.3.8 requires 112 bits of entropyThis constant defines the minimum entropy value required for a random value to be considered secure. The value is based on the Baseline Requirements (BR) version 1.3.8, which mandates a minimum of 112 bits of entropy for cryptographic security.
- See Also:
-
perCharacterEntropy
private final double perCharacterEntropyCalculate and cache the entropy per character in the constructor to save time when validating random valuesThis field stores the entropy per character, which is calculated once during the construction of the object.
-
randomValueValidityPeriod
private final int randomValueValidityPeriodDefault validity period for random value is 30 daysThis field defines the default validity period for a random value, which is set to 30 days.
-
-
Constructor Details
-
RandomValueVerifier
Constructs a new RandomValueVerifier with the specified configuration.- Parameters:
dcvContext
- context where we can find the needed dependencies / configurationThis constructor initializes the RandomValueVerifier with the given DCV context.
-
-
Method Details
-
verifyRandomValue
Verifies the given random value for validity and entropy.- Parameters:
randomValue
- The random value to verify.prepareTime
- The time when the random value was prepared.- Throws:
DcvException
- If the random value is invalid or has insufficient entropy.
-
calculatePerCharacterEntropy
Calculates the entropy per character for the given random value generator.- Parameters:
randomValueGenerator
- The random value generator to use for calculating entropy.- Returns:
- The entropy per character.
-
isEntropySufficient
Checks if the given random value has sufficient entropy.- Parameters:
randomValue
- The random value to check.- Returns:
- True if the random value has sufficient entropy, false otherwise.
This method evaluates whether the provided random value has sufficient entropy to meet security requirements.
-