04.02.2016, 09:42
For now we only have support for SSL/TLS in client mode, here's a short example. If handshake fails, try setting proto to tlsv1.
Code:
require('socket')
require('ssl')
host = '127.0.0.1'
port = '443'
proto = 'tlsv12' -- can also be 'tlsv1' or 'tlsv11'
sock = socket.tcp()
res, err = sock:connect(host, port)
if res then
sock = ssl.wrap(sock, proto)
res, err = sock:dohandshake()
if res then
...
else
log('Handshake failed', err)
end
else
log('Connect failed', err)
end
sock:close()