Home  Contents

pki:generateKeyPair()

Cipher/PKI Core4 Lua Commands

SYNOPSIS

result = pki:generateKeyPair(size)

DESCRIPTION

Generates a new random RSA key pair, using the specified key size in bits.

When done, the key's private and public components can be retrieved with the save functions: pki:privateKey(), pki:publicKey(), pki:savePrivateKey() and pki:savePublicKey().

A self-signed certificate for use with a webserver can be generated by calling pki:getSelfSignedCertData() or pki:saveSelfSignedCertFile().

On the V4 / V4½ controllers, generation of a new key can take several seconds, especially for key sizes 2048 and larger.

RETURN VALUE

On success, returns true, the new key pair is stored in the object.

In case of an error returns three values: nil, a string describing the error and a negative error code from the underlying mbed TLS implementation.

SEE ALSO