security.RandomGenerator.CreateRandomString

Creates a random base64 string.

Syntax

security.RandomGenerator.CreateRandomString(
   size INTEGER )
  RETURNING result STRING
  1. size is the size of the random string.
  2. result is the generated random string in Base64.

Usage

Generates a random binary data of size bytes long and returns it in a STRING encoded in a Base64 form.

The size must be greater than 0.

Use this function when randomness is required, such as in xml.CryptoKey.deriveKey() or security.Digest.CreateDigestString().

This method is based on openssl, using /dev/random on Unix and CryptGenRandom() on Microsoft Windows, which are following CSPRNG specifications.

In case of error, the method throws an exception and sets the STATUS variable. Depending on the error, a human-readable description of the problem is available in the SQLCA.SQLERRM register. See Error handling in GWS calls (STATUS).