Home Contents | # cipher.pki | Cipher/PKI | Core4 Lua Commands

## SYNOPSIS

1. pki = cipher.pki([ciphersuite[, padding[, hash]]])
2. pki:close()

## DESCRIPTION

The Core4 system includes a copy of mbed TLS.

This function creates an object for working with public/private key pairs.
The object can store a single public or private key.
After creation, the object is initialized for a specific ciphersuite, but contains no key.

The default object is created with the RSA ciphersuite, using PKCS V15 padding and a SHA256 hash.

The listed ciphersuites by mbedTLS are: RSA, EC, ECDH, ECDSA.

Padding options are either V15 or V21.

Supported hashes are: MD2, MD4, MD5, SHA1, SHA224, SHA256, SHA384, SHA512, RIPEMD160.

Closing the object discards all stored key data. After closing, the object becomes unusable.

## RETURN VALUE

A pki key storage instance.

## SEE ALSO

pki:keysize(), pki:privateKey(), pki:publicKey(), pki:savePrivateKey(), pki:savePublicKey(), pki:loadKeyData(), pki:loadKeyFile(), pki:loadPublicKeyData(), pki:loadPublicKeyFile(), pki:key(), pki:setKey(), pki:info(), pki:generateKeyPair(), pki:matchWithPublicKey(), pki:matchWithPrivateKey(), pki:encrypt(), pki:decrypt(), pki:sign(), pki:verify(), pki:getSelfSignedCertData(), pki:saveSelfSignedCertFile(), pki:getCipherSuite()