Class CryptoRandomProvider
This class provides a singleton SecureRandom instance configured
to use the JDK's NIST SP 800-90A Rev. 1 DRBG (Deterministic Random Bit
Generator) when available. The instantiation requests only:
- 256-bit security strength
- the
DrbgParameters.Capability.PR_AND_RESEEDcapability (prediction resistance and reseeding) - no personalization string
The request names no DRBG mechanism. The mechanism and its underlying
primitive are chosen by the provider from the securerandom.drbg.config
security property of the JVM the SDK runs in; the JDK default is
Hash_DRBG with SHA-256. getProviderInfo() reports
the algorithm and provider actually obtained.
If DRBG is not available on the platform (e.g., older JVMs or Android),
the provider falls back to SecureRandom.getInstanceStrong() or
the platform's default SecureRandom.
This class mirrors the NIST DRBG pattern the ANKASecure server uses, ensuring consistent cryptographic random number generation across the platform.
-
Method Summary
Modifier and TypeMethodDescriptionstatic SecureRandomget()Returns the singletonSecureRandominstance.static StringReturns information about the underlying random provider.
-
Method Details
-
get
Returns the singletonSecureRandominstance.This instance is thread-safe and should be used for all cryptographic operations requiring secure random bytes.
- Returns:
- the singleton SecureRandom instance
-
getProviderInfo
Returns information about the underlying random provider.- Returns:
- a string describing the algorithm and provider
-