--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/key/loadkey.lua Sat Jul 24 13:40:16 2010 +0100 @@ -0,0 +1,29 @@ +-- +-- Public domain +-- +require("ssl") + +local pass = "foobar" +local cfg = { + protocol = "tlsv1", + mode = "client", + key = "key.pem", +} + +-- Shell +print(string.format("*** Hint: password is '%s' ***", pass)) +ctx, err = ssl.newcontext(cfg) +assert(ctx, err) +print("Shell: ok") + +-- Text password +cfg.password = pass +ctx, err = ssl.newcontext(cfg) +assert(ctx, err) +print("Text: ok") + +-- Callback +cfg.password = function() return pass end +ctx, err = ssl.newcontext(cfg) +assert(ctx, err) +print("Callback: ok")