从 DoD CAC 卡获取客户端证书
我有一个使用 LibCurl 的 C 应用程序(LibCurl 是一个与 Web 服务器建立 HTTP 连接的 C API)。使用 LibCurl,我需要从需要客户端证书的 HTTPS 服务器下载文件。
到目前为止,我们的技术解决方案效果很好。
我的问题是我们需要使用的客户端证书驻留在 DoD CAC 卡上。我需要能够从 DOD CAC 卡中提取客户端证书(从我的 C 应用程序中),并将其写入文件或仅引用 CAC 上的文件。然后,此写入或引用的文件将被指定为我的 HTTPS 连接中的客户端证书。
我不知道如何从 DoD CAC 卡中查找或引用客户端证书。非常感谢任何帮助。谢谢。
I have a C application that uses LibCurl (LibCurl is a C API that makes an HTTP connection to a web server). Using LibCurl I need to download a file from an HTTPS server that requires a client certificate.
So far our technical solution works great.
My problem is that the client certificate that we need to use resides on a DoD CAC card. I need to be able to pull the client certificate off of the DOD CAC card (from within my C app) and either write it to a file or just reference the file on the CAC. This written or referenced file will then be specified as my client certificate in my HTTPS connection.
I do not know how to locate or reference the client certificate off the DoD CAC Card. Any help is very much appreciated. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当 activeClient 将 CAC 卡证书发布到 Windows 时,它应该将证书导出到存储区。您可能需要自动将证书从本地证书存储导出到 .pfx 或 .p7b 格式等文件。也许.cer,我不知道这是否可能。它需要受到密码保护。
我认为如果没有中间层(如证书存储),您无法直接从 CAC 卡执行此操作。
When activeClient publishes the CAC card certs to windows it should export the certs to the store. You may need to automate the exporting of the certificate from your local cert store to a file like .pfx or .p7b format. Maybe .cer, I don't know if that's possible. It'll need to be pwd protected.
I don't think you can do it directly from the CAC card without an intermediary middle layer (like the cert store).
这是 C# 的方法,它可能对 C 有帮助,我真的不熟悉 C 代码。
获取和导出证书的代码是
导出方法有多种导出类型我不确定其中是否是您所指的格式。这是你需要玩的东西。我什至不确定您是否能够在 C 中使用这些库,但以防万一您可以我发布它们。
This is the method for C# it may help with C I'm really not familiar with C code.
The code to get and export the cert is
The export method has various types to export to I am not sure if one will be the format you are referring to. This is something you will need to play with. I am not even sure you will be able to use those libraries in C but just in case you could I posted them.