From 0362804658c4b7eb4abc2c4c9a64e154855c24ee Mon Sep 17 00:00:00 2001 From: daurnimator Date: Mon, 7 Nov 2016 23:30:24 +1100 Subject: openssl.ssl.context: Add :getStore() that returns the ssl context's internal x509 store --- src/openssl.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/openssl.c b/src/openssl.c index d7b572e..d4f75aa 100644 --- a/src/openssl.c +++ b/src/openssl.c @@ -7263,6 +7263,20 @@ static int sx_setStore(lua_State *L) { } /* sx_setStore() */ +static int sx_getStore(lua_State *L) { + SSL_CTX *ctx = checksimple(L, 1, SSL_CTX_CLASS); + X509_STORE *store; + + if((store = SSL_CTX_get_cert_store(ctx))) { + xs_push(L, store); + } else { + lua_pushnil(L); + } + + return 1; +} /* sx_getStore() */ + + static int sx_setVerify(lua_State *L) { SSL_CTX *ctx = checksimple(L, 1, SSL_CTX_CLASS); int mode = luaL_optint(L, 2, -1); @@ -7529,6 +7543,7 @@ static const auxL_Reg sx_methods[] = { { "getOptions", &sx_getOptions }, { "clearOptions", &sx_clearOptions }, { "setStore", &sx_setStore }, + { "getStore", &sx_getStore }, { "setVerify", &sx_setVerify }, { "getVerify", &sx_getVerify }, { "setCertificate", &sx_setCertificate }, -- cgit v1.2.3-59-g8ed1b