diff options
author | Steven Barth <steven@midlink.org> | 2009-06-07 10:15:12 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2009-06-07 10:15:12 +0000 |
commit | 0ebce1d6088a3a503ab038fd5ab81357ccabe625 (patch) | |
tree | 94027dc509d18c6f11aaf52130c9a2a668edfd71 /libs/nixio | |
parent | 4934c979788a7da5a68c6a21b89734e20b5044a5 (diff) |
nixio: Add support for DER certificates, PX5G fix Certmaster
Diffstat (limited to 'libs/nixio')
-rw-r--r-- | libs/nixio/root/etc/nixio/.nixio_stamp | 0 | ||||
-rw-r--r-- | libs/nixio/src/tls-context.c | 17 |
2 files changed, 16 insertions, 1 deletions
diff --git a/libs/nixio/root/etc/nixio/.nixio_stamp b/libs/nixio/root/etc/nixio/.nixio_stamp new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/libs/nixio/root/etc/nixio/.nixio_stamp diff --git a/libs/nixio/src/tls-context.c b/libs/nixio/src/tls-context.c index e55de05cc..235a72382 100644 --- a/libs/nixio/src/tls-context.c +++ b/libs/nixio/src/tls-context.c @@ -113,7 +113,22 @@ static int nixio_tls_ctx_create(lua_State *L) { static int nixio_tls_ctx_set_cert(lua_State *L) { SSL_CTX *ctx = nixio__checktlsctx(L); const char *cert = luaL_checkstring(L, 2); - return nixio__tls_pstatus(L, SSL_CTX_use_certificate_chain_file(ctx, cert)); + const char *type = luaL_optstring(L, 3, "chain"); + int ktype; + + if (!strcmp(type, "chain")) { + return nixio__tls_pstatus(L, + SSL_CTX_use_certificate_chain_file(ctx, cert)); + } else if (!strcmp(type, "pem")) { + ktype = SSL_FILETYPE_PEM; + } else if (!strcmp(type, "asn1")) { + ktype = SSL_FILETYPE_ASN1; + } else { + return luaL_argerror(L, 3, "supported values: chain, pem, asn1"); + } + + return nixio__tls_pstatus(L, + SSL_CTX_use_certificate_file(ctx, cert, ktype)); } static int nixio_tls_ctx_set_key(lua_State *L) { |