Home Contents | # rawio:setSSL | Rawio | Core4 Lua Event System

## SYNOPSIS

1. success = handle:setSSL(ssl)
2. ssl = handle:getSSL()

## DESCRIPTION

The Core4 system includes a commercial PolarSSL license.

With rawio:setSSL() it is possible to switch a handle into SSL/TLS mode. The handle must be a TCP socket. For any other type of handle the behaviour is undefined.

To enable SSL mode, first a SSL configuration must be set up. This setup contains certificates, private keys and any other configuration needed for SSL. More information about the needed configuration is on the page about the SSL configuration object.

Once a setup has been prepared, it is configured into the handle with rawio:setSSL(). It is also possible to read back the SSL configuration with rawio:getSSL().

The SSL setup can be called anytime. It is usually called immediately after the socket is created, either by rawio.socket() or rawio:accept().

To initialize SSL after the socket connection has been established, use rawio:handshake().

## RETURN VALUE

On success, rawio:setSSL() returns true, on failure it returns nil. In case of an error, the error can be retrieved using rawio:lastError().

The function rawio:getSSL() returns a reference to the configured SSL setup. If no SSL has been set up for the handle, it returns nil.

## SEE ALSO

cipher.ssl(), rawio:handshake(), rawio:getPeerCertInfo(), rawio:getCipherSuite(), rawio:getCompression()