Home  Contents

pki:encrypt()

Cipher/PKI Core4 Lua Commands

SYNOPSIS

  1. ciphertext = pki:encrypt(plaintext)
  2. plaintext = pki:decrypt(ciphertext)

DESCRIPTION

Run some data through asymetric encryption/decryption.

The functions require that a key has previously been stored inside the object.

Since asymetric encryption tends to be slow, typically this is only used to encrypt/decrypt a key that is further on used to run symetric encryption, like AES.

RETURN VALUE

On success, returns the encrypted/decrypted data.

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