top of page



create_asymmetric_priv_key(algorithm, {key_len|dh_secret})

Creates a private key using the given algorithm and key length or DH
secret, and returns the key as a binary string in PEM format. If key
generation fails, the result is NULL.

Supported algorithm values: 'RSA', 'DSA', 'DH'

Supported key_len values: The minimum key length in bits is 1,024. The
maximum key length depends on the algorithm: 16,384 for RSA and 10,000
for DSA. These key-length limits are constraints imposed by OpenSSL.
Server administrators can impose additional limits on maximum key
length by setting environment variables.
For DH keys, pass a shared DH secret instead of a key length. To create
the secret, pass the key length to create_dh_parameters().


SET @priv = create_asymmetric_priv_key('DSA', 2048);
SET @pub = create_asymmetric_pub_key('DSA', @priv);

bottom of page