如何使用CNG枚举Windows证书? [英] How to enumerate windows certificates using CNG?

查看:127
本文介绍了如何使用CNG枚举Windows证书?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



使用CryptoAPI,我可以使用CertOpenStore()和CertEnumCertificatesInStore()打开Windows Cert Store并枚举证书。   CNG是否提供任何类似的API来访问存储在Windows Cert Store中的证书,或者我是否坚持使用
CryptoAPI?

Hi,

With CryptoAPI, I can open the Windows Cert Store and enumerate certificates using CertOpenStore() and CertEnumCertificatesInStore().  Does CNG offer any similar API to access certificates that are stored in the Windows Cert Store, or am I stuck with using CryptoAPI?


谢谢!


Dong

Dong

推荐答案

CertOpenStore和CertEnumCertificatesInStore是"证书存储功能"。并且不是CryptoAPI功能。证书商店
包含公共部分证书,您可以使用"证书存储功能"检索它们:

CertOpenStore and CertEnumCertificatesInStore are "Certificate Store Functions" and are not CryptoAPI functions. Certificate stores contain public portion of certificates and you can retrieve them using "Certificate Store Functions":

http://msdn.microsoft.com/en-us/library/windows/desktop/aa380252%28v=vs .85%29.aspx#certificate_and_certificate_store_functions

CSP / CNG模块负责存储私钥并提供加密操作。存储在证书存储中的每个证书都可以与保存其私钥(如果有)的CSP或CNG模块有关。但是,对于
智能卡CSP和CNG(即KSP)模块,您可以使用对CPGetProvParam(PP_ROOT_CERTSTORE)和CPGetProvParam(PP_USER_CERTSTORE)或(在CNG情况下)调用的方式检索智能卡上存储的证书。 NCryptGetProperty(NCRYPT_CERTIFICATE_PROPERTY),
NCryptGetProperty(NCRYPT_ROOT_CERTSTORE_PROPERTY)和NCryptGetProperty(NCRYPT_USER_CERTSTORE_PROPERTY)。

CSP/CNG modules are responsible for storing private keys and also providing cryptography operations. Each certificate stored in the certificate store can have a relation to a CSP or CNG module which holds its private key (if any). However, in the case of Smartcard CSP and CNG (i.e. KSP) modules, then you may retrieve stored certificates on the smartcard using calls to CPGetProvParam(PP_ROOT_CERTSTORE) and CPGetProvParam(PP_USER_CERTSTORE) or (in case of CNG) calls to NCryptGetProperty(NCRYPT_CERTIFICATE_PROPERTY), NCryptGetProperty(NCRYPT_ROOT_CERTSTORE_PROPERTY), and NCryptGetProperty(NCRYPT_USER_CERTSTORE_PROPERTY).

----

Nima Sharifimehr。

sbucsc at yahoo dot com

----
Nima Sharifimehr.
sbucsc at yahoo dot com


这篇关于如何使用CNG枚举Windows证书?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆