xml.CryptoKey.generateKey

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

Syntax

generateKey(
   size INTEGER )
  1. size is the size of the key to generate.

Usage

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 according to the previously loaded parameters. For details on loading parameters, see Table 4.

In case of error, the method throws an exception and sets the STATUS variable with the appropriate error number.