Home Contents | # httpd:loadCertData | Httpd | Core4 Lua Event System

## SYNOPSIS

1. ok, err, errcode = httpd:loadCertData(data)
2. ok, err, errcode = httpd:loadCertFile(filename)

## DESCRIPTION

This setting is necessary when using SSL/TLS with the built-in webserver.

The local certificate is the identification of this machine. When a client connects, it is presented to the peer. The client can then decide whether to accept or reject the connection.

The certificate data is public and does not need to be kept secure.

The system can load a certificate in X509 PEM or BER format.

A local certificate goes together with a local RSA key pair, see httpd:loadKeyFile().

The function httpd:loadCertData() loads the certificate from the data passed in a string variable.

The second function, httpd:loadCertFile() instead loads the certificate directly from a file.

## RETURN VALUE

Returns true on success.

In case of an error they return three values: nil, a string describing the error and a negative error code from the underlying PolarSSL implementation.

## SEE ALSO

httpd:loadKeyData(), httpd:loadKeyFile(), httpd:secureListen()