如何使用CNG枚举所有连接的智能卡上的按键? [英] How to enumerate keys on all connected smart cards using CNG?

查看:74
本文介绍了如何使用CNG枚举所有连接的智能卡上的按键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在尝试枚举"Microsoft智能卡密钥存储提供程序"的密钥,但只获得了一个智能卡或安全令牌的密钥列表。代码

Hello, I'm trying to enumerate keys of "Microsoft Smart Card Key Storage Provider", but got a list of keys from only one smart card or security token. Code

NCryptSetProperty(hProv,NCRYPT_READER_PROPERTY,(PBYTE)读者,(wcslen(读者)+ 1)* sizeof(wchar_t),0);

NCryptSetProperty(hProv, NCRYPT_READER_PROPERTY, (PBYTE)reader, (wcslen(reader) + 1) * sizeof(wchar_t), 0);

仅影响密钥创建。是的,新密钥将完全在我选择的阅读器上创建。但是如何处理关键枚举?

affects only key creation. Yes, new key is to be created exactly on the reader that I chose. But what to do with key enumeration?

请帮助。

推荐答案

此处存在同样的问题。我有两个令牌(智能卡)连接到我的W7盒子。每张卡上都有2张证书,它们都存在于用户MY证书库中。所以逻辑上NCryptEnumKeys

Same problem here. I have two tokens (Smartcards) connected to my W7 box. Every card has 2 certificates on it, and they are all present in users MY certificate store. So logicaly NCryptEnumKeys

while(NT_SUCCESS(status = NCryptEnumKeys(phProvider,NULL,& pKeyName,& pEnumState,0)))

while(NT_SUCCESS(status = NCryptEnumKeys(phProvider, NULL, &pKeyName, &pEnumState, 0)))

应该返回4个容器,但它只从一个令牌中检索密钥容器。是否有可能从所有连接的令牌中枚举关键容器?如果是,那该怎么办?

should return 4 containers, but it retrieves key containers from one token only. Is there a posibility to enumerate key containers from all connected tokens? If YES, how can it be done?


这篇关于如何使用CNG枚举所有连接的智能卡上的按键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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