Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/267.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我如何访问;证书注册申请”;存储在C#?_C#_Certificate_X509certificate - Fatal编程技术网

我如何访问;证书注册申请”;存储在C#?

我如何访问;证书注册申请”;存储在C#?,c#,certificate,x509certificate,C#,Certificate,X509certificate,如何通过C#访问存储在证书注册请求存储中的密钥 我尝试使用: var requestCertStore = new X509Store("Certificate Enrollment Requests", StoreLocation.LocalMachine); requestCertStore.Open(OpenFlags.MaxAllowed); var certs = requestCertStore.Certi

如何通过C#访问存储在证书注册请求存储中的密钥

我尝试使用:

var requestCertStore = new X509Store("Certificate Enrollment Requests", 
                                     StoreLocation.LocalMachine);
requestCertStore.Open(OpenFlags.MaxAllowed);
var certs = requestCertStore.Certificates;
但是
certs
集合不包含我希望在“证书注册请求”存储中访问的证书。我也看不到与此存储对应的任何内容,因此使用
新的X509Store(StoreName StoreName,StoreLocation StoreLocation)
构造函数不是一个选项


无法通过C#/.NET检索这些证书吗?

解决方案是使用
“请求”
而不是
“证书注册请求”


我在这里找到了提示:。

解决方案是使用
“请求”
而不是
“证书注册请求”


我在这里找到了提示:。

你说你不能使用带有名称和位置的构造函数,但为什么不能呢
StoreName
将是
“证书注册请求”
StoreLocation
等于
StoreLocation.LocalMachine
@mispoint先生,StoreName是一个枚举,而不是字符串。我也尝试过使用字符串构造函数,但没有成功。如上所述。@Mike Atlas:您是否以管理员身份访问该商店?只是一种预感…@Jonny,是的,绝对是一个管理员。我访问其他正常的证书存储并对其进行操作没有问题。@Mike:老实说,在挖掘了一点之后,我不认为使用CER是.NETAPI的一部分。通过使用Windows或服务器库,您可以在较低级别上使用它。我在X509上做了很多工作,但从未处理过实际的请求。你说你不能使用带有名称和位置的构造函数,但为什么不呢
StoreName
将是
“证书注册请求”
StoreLocation
等于
StoreLocation.LocalMachine
@mispoint先生,StoreName是一个枚举,而不是字符串。我也尝试过使用字符串构造函数,但没有成功。如上所述。@Mike Atlas:您是否以管理员身份访问该商店?只是一种预感…@Jonny,是的,绝对是一个管理员。我访问其他正常的证书存储并对其进行操作没有问题。@Mike:老实说,在挖掘了一点之后,我不认为使用CER是.NETAPI的一部分。通过使用Windows或服务器库,您可以在较低级别上使用它。我在X509上做了很多工作,但从未处理过实际的请求。
var requestCertStore = new X509Store("REQUEST", StoreLocation.LocalMachine);
requestCertStore.Open(OpenFlags.MaxAllowed);
var certs = requestCertStore.Certificates;