mirror of
https://github.com/brunoos/luasec.git
synced 2025-07-13 06:24:22 +02:00
Fix PSK samples
This commit is contained in:
@ -4,13 +4,20 @@
|
||||
local socket = require("socket")
|
||||
local ssl = require("ssl")
|
||||
|
||||
-- @param hint (nil | string)
|
||||
-- @param max_identity_len (number)
|
||||
-- @param max_psk_len (number)
|
||||
-- @return identity (string)
|
||||
-- @return PSK (string)
|
||||
local function pskcb(hint, max_identity_len, max_psk_len)
|
||||
print(string.format("PSK Callback: hint=%q, max_identity_len=%d, max_psk_len=%d", hint, max_identity_len, max_psk_len))
|
||||
return "abcd", "1234"
|
||||
end
|
||||
|
||||
local params = {
|
||||
mode = "client",
|
||||
protocol = "tlsv1_2",
|
||||
psk = function(hint, max_psk_len)
|
||||
print("PSK Callback: hint=", hint, ", max_psk_len=", max_psk_len)
|
||||
return "abcd", "1234"
|
||||
end
|
||||
psk = pskcb,
|
||||
}
|
||||
|
||||
local peer = socket.tcp()
|
||||
|
Reference in New Issue
Block a user