ucspi-ssl  0.12.7
ucspi-ssl
ssl_certkey.c
Go to the documentation of this file.
1 #include "ucspissl.h"
2 
3 int ssl_certkey(SSL_CTX *ctx,const char *certfile,const char *keyfile,pem_password_cb *passwd_cb)
4 {
5  if (!certfile) return 0;
6 
7  if (SSL_CTX_use_certificate_chain_file(ctx,certfile) != 1)
8  return -1;
9 
10  if (!keyfile) keyfile = certfile;
11  SSL_CTX_set_default_passwd_cb(ctx,passwd_cb);
12  if (SSL_CTX_use_PrivateKey_file(ctx,keyfile,SSL_FILETYPE_PEM) != 1)
13  return -2;
14 
15  if (SSL_CTX_check_private_key(ctx) != 1)
16  return -3;
17 
18  return 0;
19 }
int ssl_certkey(SSL_CTX *ctx, const char *certfile, const char *keyfile, pem_password_cb *passwd_cb)
Definition: ssl_certkey.c:3
const char * certfile
Definition: sslclient.c:104
const char * keyfile
Definition: sslclient.c:105
int passwd_cb(char *buf, int size, int rwflag, void *userdata)
Definition: sslclient.c:127
SSL_CTX * ctx
Definition: sslclient.c:103
Header file to be used with sqmail; previously called ssl.h. (name clash)