我发现下面的代码可以将证书安装到本地计算机受信任的发布者中。但是代码在 C# 中,我希望在 C 中完成相同的操作。如何将其转换为 C?
private static void InstallCertificate(string cerFileName)
{
X509Certificate2 certificate = new X509Certificate2(cerFileName);
X509Store store = new X509Store(StoreName.TrustedPublisher,StoreLocation.LocalMachine);
store.Open(OpenFlags.ReadWrite);
store.Add(certificate);
store.Close();
}
是否有可用的 Windows API?
最佳答案
尝试查看 libpkix lib
The purpose of the libpkix library is to provide a widely useful C library for building and validating chains of X.509 certificates, compliant with the latest IETF PKIX standards (namely, RFC 3280). This project aims to provide complete support for all the mandatory features of RFC 3280, as well as a number of optional features.
关于c# - 等效于 C# 的 C 代码,用于安装证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10731732/