首先看SSL_CTX的结构中跟证书相关的字段(其实结构里面的内容非常多)
struct ssl_ctx_st
{
struct x509_store_st /* X509_STORE */ *cert_store;
STACK_OF(X509_NAME) *client_CA;
struct cert_st /* CERT */ *cert;
STACK_OF(X509_LOOKUP) *get_cert_methods; //获取证书的方法,根据是指明文件名,还是文件路径来加载具体的函数。
}
其中cert_store里面存放的是CA和CRL x509对象;client_CA中加载的签约终端证书CA的subjectName字段名;cert中存在的则是一对密钥了,结构分别为x509和EVP_PKEY。
加载证书的函数:
int X509_STORE_load_locations(X509_STORE *ctx, const char *file,
const char *path)
{
X509_LOOKUP *lookup;
if (file != NULL)
{
lookup=X509_STORE_add_lookup(ctx,X509_LOOKUP_file());
if