I'm trying to access the certificate store on a 2008 R2 server and it says
clientCertStore.Certificates.Count = 0
The same request with the same certificate in my localhost if you return it to me, the only difference is that my PC is a W7.
The installation of the certificate has been done in the same way on both machines, with an exportable key and in the Personal store.
I do not know if it will have to do, but the certificate is expired, but as I say, on my PC if you return it to me.
private X509Certificate2 Certificate(string nif)
{
X509Certificate2 cert = null;
X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly);
X509CertificateCollection certs = store.Certificates;
int c = certs.Count;
foreach (X509Certificate2 cert_aux in certs)
{
if (cert_aux.SubjectName.Name.Contains(nif.ToUpper()))
{
cert = cert_aux; break;
}
}
store.Close();
return cert;
}