简体   繁体   English

使用Openssl API从C中的文件夹读取所有X509证书

[英]Using Openssl API to read all X509 certificates from a folder in C

In an application (in C language), I would need to attach all the CA certificates available locally. 在一个应用程序(使用C语言)中,我需要附加所有本地可用的CA证书。 So, I'm looking for some Openssl library function that could help me to load all the certificates in X509 format from a given folder (or certificate store), for example /etc/ssl/certs directory. 因此,我正在寻找一些Openssl库函数,该函数可以帮助我从给定文件夹(或证书存储)(例如/ etc / ssl / certs目录)中以X509格式加载所有证书。 I would appreciate any help in this regards. 在这方面的任何帮助,我将不胜感激。

Thanks, Ankit 谢谢安吉

I'm assuming this is what you wanted: SSL_CTX_load_verify_locations() ? 我假设这是您想要的: SSL_CTX_load_verify_locations()吗?

I understand the OpenSSL documentation is dense, but you're going to have to be able to find what you need in it (and not via a stackoverflow question). 我了解OpenSSL文档非常密集,但是您将必须能够在其中找到所需的内容(而不是通过stackoverflow问题)。

Make sure if you added new certificates to that directory that you re-run c_rehash, as mentioned in the documentation. 请确保是否向该目录添加了新证书,然后重新运行c_rehash,如文档中所述。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM