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

标签 c# c windows winapi certificate

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

相关文章:

python - 如何使用批处理文件 (.bat) 使用 ACTIVATED virtualenv 运行 django 服务器

windows - 带有空格和括号的批处理文件变量

c++ - 排队的事件数量? (Win32 事件队列)

c# - 如何在 ASP.NET Core 3 Razor Pages 中使用环境路由值?

c# - 为什么一个类的序列化结果在不同的机器上是不同的?

c - gdb 如何在 linux 上调试多线程守护程序时中断新线程

c++ - 指针和架构的大小

c# - 如何在 Xamarin.Forms 的 MainPage 上创建动态按钮列表?

c# - 使用 Caliburn.Micro 将命令绑定(bind)到 ListView 内的按钮

c - 使用指针在c中反转字符串