c++ - 我可以在单独的 ssl 上下文之间重用 openssl x509store 吗?

标签 c++ openssl

我有一个 C++ 应用程序,它使用 OpenSSL 创建多个到不同端点的 http 客户端。在设置 ssl 上下文期间,我将 Mozilla pem 文件加载到单个 X509STORE 对象中。

X509_STORE* thestore = globalstuffs::getInstance().x509store;
SSL_CTX_set_cert_store(sslctx_->native_handle(), thestore);

我的想法是这样做而不是从文件加载,以节省每次使用 sslctx_->load_verify_file(file);sslctx_->set_default_verify_paths(); 到磁盘的时间;

单个客户端没有问题,但是当我有多个客户端时,在第二个 ssl 上下文的拆卸过程中,我在 CRYPTO_free 中遇到了错误。调用堆栈显示 X509_STORE_free,所以我假设这是使用同一商店的问题。有解决办法吗?

最佳答案

Can I reuse an openssl x509store between separate ssl contexts?

如果您共享信任和 key Material ,您应该重用相同的 SSL 上下文。这就是它的用途。

关于c++ - 我可以在单独的 ssl 上下文之间重用 openssl x509store 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40898763/

相关文章:

c++ - 访问冲突 _mm_store_si128 SSE Intrinsics

c++ - 生成 float 随机数

c++ - OpenCV:如何迭代图像特定区域中的每个像素

php - CentOS 5.10 无法启用 php-openssl 扩展

nginx - 使用 Nginx (ngx_http_ssl_module) 编译时,: Openssl, LibreSSL 或 BoringSSL 哪个更好?

c++ - 在 OpenGL 中绘制单个像素

c++ - C++ 中的外部:对于外部 VarX 变量::错误 LNK2001:未解析的外部符号 "unsigned int VarX"(?VarX@@3IA)

php - openssl_csr_sign 返回 false 无法获取证书

c - OpenSSL 和 AES

php - 如何在PHP 5.2.1中加载openssl.so动态库