Open Search
    SecureRandom Class Reference

    #include <secure_random.h>

    Detailed Description

    Class for generating cryptographically strong random sequences. The following systems are used:

    Static Public Member Functions

    static MAXON_METHOD SecureRandomProvider GetDefaultProvider ()
     
    static MAXON_METHOD Bool GetRandomNumber (SecureRandomProvider provider, const Block< Byte > &buffer)
     

    Private Member Functions

     MAXON_INTERFACE_NONVIRTUAL (SecureRandom, MAXON_REFERENCE_STATIC, "net.maxon.interface.securerandom")
     

    Member Function Documentation

    ◆ MAXON_INTERFACE_NONVIRTUAL()

    MAXON_INTERFACE_NONVIRTUAL ( SecureRandom  ,
    MAXON_REFERENCE_STATIC  ,
    "net.maxon.interface.securerandom"   
    )
    private

    ◆ GetDefaultProvider()

    static MAXON_METHOD SecureRandomProvider GetDefaultProvider ( )
    static

    Gets a provider for the CSPRNG.

    Returns
    The provider. If the return value is nullptr the function failed.

    ◆ GetRandomNumber()

    static MAXON_METHOD Bool GetRandomNumber ( SecureRandomProvider  provider,
    const Block< Byte > &  buffer 
    )
    static

    Gets a provider for the CSPRNG.

    Returns
    The provider. If the return value is nullptr the function failed. Fills the buffer with cryptographically strong random bytes. example: SecureRandom::GetRandomNumber(provider, ToBlock<Byte>(certificateBuffer, SIZEOF(certificateBuffer)));
    Parameters
    [in]providerThe secure random provider.
    [in]bufferA pointer to a buffer that is to be filled.
    Returns
    True, if the buffer was filled successfully, false otherwise.