是否有任何方法可以获取SSL_CTX中加载的CA证书和客户端证书。我已经以这种方式初始化了SSL_CTX:
char* cacertFile = "cacert.crt";
char* certFile = "server.crt";
char* keyFile = "server.key";
if (!SSL_CTX_load_verify_locations(ctx, cacertFile, NULL)) {
std::cout << "cannot load cacerts" << std::endl;
} else {
std::cout << "cacert loaded" << std::endl;
}
if (!SSL_CTX_use_certificate_file(ctx, certFile, SSL_FILETYPE_PEM)) {
std::cout << "cannot load certfile" << std::endl;
} else {
std::cout << "certfile loaded" << std::endl;
}
if (!SSL_CTX_use_PrivateKey_file(ctx, keyFile, SSL_FILETYPE_PEM)) {
std::cout << "cannot load private key" << std::endl;
} else {
std::cout << "private key loaded" << std::endl;
}
稍后我想查询或从SSL_CTX中找到向此证书添加了哪些ca证书,(服务器)证书是什么?有什么例子吗?