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 NIST SP 800-90A Rev. 1 DRBG (Deterministic Random Bit Generator) when available. The DRBG implementation uses:

  • CTR_DRBG with AES-256 as the underlying block cipher
  • 256-bit security strength
  • Prediction resistance enabled
  • Automatic reseeding

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 used in the server-side ankasecure-common-infrastructure library, ensuring consistent cryptographic random number generation across the platform.

Since:
3.0.0
Author:
AnkaTech R&D
  • 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