Class CryptoRandomProvider

java.lang.Object
co.ankatech.ankasecure.sdk.util.CryptoRandomProvider

public final class CryptoRandomProvider extends Object
Centralized provider for cryptographically secure random number generation.

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:

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 Details

    • get

      public static SecureRandom get()
      Returns the singleton SecureRandom instance.

      This instance is thread-safe and should be used for all cryptographic operations requiring secure random bytes.

      Returns:
      the singleton SecureRandom instance
    • getProviderInfo

      public static String getProviderInfo()
      Returns information about the underlying random provider.
      Returns:
      a string describing the algorithm and provider