From 1087d4df2a7342d2832ba3bab1843bf4a3040775 Mon Sep 17 00:00:00 2001 From: Jannis Hoffmann Date: Sun, 14 Jul 2024 21:28:19 +0200 Subject: add version 0.12.10 --- src/ssl_certkey.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/ssl_certkey.c (limited to 'src/ssl_certkey.c') diff --git a/src/ssl_certkey.c b/src/ssl_certkey.c new file mode 100644 index 0000000..8292cbe --- /dev/null +++ b/src/ssl_certkey.c @@ -0,0 +1,19 @@ +#include "ucspissl.h" + +int ssl_certkey(SSL_CTX *ctx,const char *certfile,const char *keyfile,pem_password_cb *passwd_cb) +{ + if (!certfile) return 0; + + if (SSL_CTX_use_certificate_chain_file(ctx,certfile) != 1) + return -1; + + if (!keyfile) keyfile = certfile; + SSL_CTX_set_default_passwd_cb(ctx,passwd_cb); + if (SSL_CTX_use_PrivateKey_file(ctx,keyfile,SSL_FILETYPE_PEM) != 1) + return -2; + + if (SSL_CTX_check_private_key(ctx) != 1) + return -3; + + return 0; +} -- cgit v1.2.3