如何从C#中的USB令牌读取证书 [英] How to read a certificate from a USB token in C#

查看:136
本文介绍了如何从C#中的USB令牌读取证书的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个USB令牌,其中包含带有公共密钥和私有密钥的加密证书。现在,我想用C#创建一个应用程序,通过它可以找到可访问的证书信息。当我插入USB令牌时,它已被检测到,但是由于闪存驱动器的情况,计算机段上没有显示驱动器。

I have a USB token containing an encryption certificate which has a public key and private key. Now I want to create an application in C# through which I can find out the accessible certificate information. When I plug the USB token in, it is being detected, but no drive has been shown on the computers segment as it happens with the flash drives.

我如何读取是从USB驱动器中获取证书吗?

How can I read the certificate from the USB drive?

推荐答案

您可以使用 X509Store浏览证书列表类。它不仅可以为您提供USB认证,还可以为您提供计算机认证。然后,使用 X509Certificate2UI ,您可以从图形UI列表中选择正确的证书。

You can browse through a list of certificates with X509Store class. It will give you not only the certification in you USB, but also in your computer. Then with X509Certificate2UI you can select the right certificate from a graphical UI list.

此实现示例可以很好地工作开始:
http://msdn.microsoft.com/zh-CN/library/system.security.cryptography.x509certificates.x509certificate2ui(v = vs.110).aspx

This implementation example works fine to get started: http://msdn.microsoft.com/en-us/library/system.security.cryptography.x509certificates.x509certificate2ui(v=vs.110).aspx

这篇关于如何从C#中的USB令牌读取证书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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