diff options
Diffstat (limited to 'src/ssl_chainfile.c')
-rw-r--r-- | src/ssl_chainfile.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/ssl_chainfile.c b/src/ssl_chainfile.c new file mode 100644 index 0000000..9e353c2 --- /dev/null +++ b/src/ssl_chainfile.c @@ -0,0 +1,24 @@ +/** + @file ssl_certchainfile.c + @author feh + @brief Enables Certificate chain file presentation for sslserver +*/ +#include "ucspissl.h" + +int ssl_chainfile(SSL_CTX *ctx,const char *certchainfile,const char *keyfile,pem_password_cb *passwd_cb) +{ + if (!certchainfile) return 0; + if (!keyfile) return 0; + + if (SSL_CTX_use_certificate_chain_file(ctx,certchainfile) <= 0) + return -1; + + 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; +} |