Generates a random key of given size (in bits).


   keySize INTEGER )
  1. keySize defines the size of the key to generate.


For symmetric keys, the size is fixed by the key identifier and cannot be changed. The only authorized values are the real key size or NULL.

For Diffie-Hellman, the input parameter (size INTEGER) is the size of the Diffie-Hellman modulus. If the given size is greater than zero (0), it populates the Diffie-Hellman object by randomly generating a modulus of the given size and a private key, and computes the public key. The used generator is two (2). If the given size is zero (0), it completes the Diffie-Hellman object by choosing a private key and computing the public key based on the previously loaded parameters. For more details on loading parameters, see Table 4.

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).