Home  Contents

rawio:handshake

Rawio Core4 Lua Event System

SYNOPSIS

success = handle:handshake()

DESCRIPTION

This function performs the necessary handshake to establish a SSL/TLS connection. It must be called after the socket has been configured for ssl with rawio:setSSL() and after the TCP connection has been established.

The function will not return until the SSL handshake is complete. For a 2048 bit RSA keypair, this can take about two seconds.

The SSL subsystem caches information about each connection that allows the handshake to complete much faster on a reconnect. This cache is stored in RAM and is lost whenever the Lua process restarts.

Once the handshake has completed, information about the peer's certificate can be retrieved by calling rawio:getPeerCertInfo(). This is of course only possible if the peer has provided a certificate of its own.

RETURN VALUE

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

If the handle has not been set up for SSL, the function always returns true.

SEE ALSO