mirror of
https://github.com/brunoos/luasec.git
synced 2024-12-29 05:48:22 +01:00
30 lines
576 B
Lua
30 lines
576 B
Lua
|
--
|
||
|
-- Public domain
|
||
|
--
|
||
|
local socket = require("socket")
|
||
|
local ssl = require("ssl")
|
||
|
|
||
|
local params = {
|
||
|
mode = "client",
|
||
|
protocol = "tlsv1_2",
|
||
|
key = "certs/clientRSAkey.pem",
|
||
|
certificate = "certs/clientRSA.pem",
|
||
|
verify = "none",
|
||
|
options = "all",
|
||
|
ciphers = "ALL:!ECDSA"
|
||
|
}
|
||
|
|
||
|
local peer = socket.tcp()
|
||
|
peer:connect("127.0.0.1", 8888)
|
||
|
|
||
|
-- [[ SSL wrapper
|
||
|
peer = assert( ssl.wrap(peer, params) )
|
||
|
assert(peer:dohandshake())
|
||
|
--]]
|
||
|
|
||
|
local i = peer:info()
|
||
|
for k, v in pairs(i) do print(k, v) end
|
||
|
|
||
|
print(peer:receive("*l"))
|
||
|
peer:close()
|