gpt4 book ai didi

c# - 等效于 C# 的 C 代码,用于安装证书

转载 作者:可可西里 更新时间:2023-11-01 09:48:26 25 4
gpt4 key购买 nike

我发现下面的代码可以将证书安装到本地计算机受信任的发布者中。但是代码在 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com