RNG_BytesWithPrompt generates a random set of byte data suitable for cryptographic keys
with a prompt for the user to enter random keystrokes and mouse movements.
Public Declare Function RNG_BytesWithPrompt Lib "diCryptoSys.dll" (ByRef abOutput As Byte, ByVal nOutputLen As Long, ByVal strPrompt As String, ByVal nOptions As Long) As Long
nRet = RNG_BytesWithPrompt(abOutput(0), nOutputLen, strPrompt, nOptions)
Byte array to receive the random data.Long specifying the required length in bytes.String specifying an (optional) prompt for the dialog.
Specify an empty string ("") or NULL to use the default dialog.Long option flags:
long _stdcall RNG_BytesWithPrompt(unsigned char *lpOutput, long nOutputLen, const char *szPrompt, long nOptions);
Long: If successful, the return value is 0.
If the parameters are invalid, it returns a negative error code.
Rng.BytesWithPrompt Method (Int32)
Once started, there is no way to abandon the dialog that prompts the user except by terminating the process. Some applications may not handle the GUI dialog. Make your own tests to check. The maximum number of random bytes that can be requested in one call is 65,536 (64 kB). See Random Number Generator for more information on the RNG and its compliance with the relevant standards.
Dim abData() As Byte Dim nDataLen As Long ' Allocate byte array for 16 bytes nDataLen = 16 ReDim abData(nDataLen - 1) ' Default prompt with default 112-bit security strength Call RNG_BytesWithPrompt(abData(0), nDataLen, "", 0) Debug.Print cnvHexStrFromBytes(abData) ' User-selected prompt with 128-bit security strength Call RNG_BytesWithPrompt(abData(0), nDataLen, "Our own prompt: type until done...", API_RNG_STRENGTH_128) Debug.Print cnvHexStrFromBytes(abData)
RNG_KeyBytes
RNG_HexWithPrompt