Finding a certificate in the X509Store

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hello All,

I am trying to find a certificate but I am unable to find the
certificate that I want. I am using the following code:

<code>
....
string SearchTerm = "XXXXXXXXXXX";

X509Store oX509Store = new X509Store(StoreName.Root,
StoreLocation.LocalMachine);
oX509Store.Open(OpenFlags.ReadOnly);

X509Certificate2Collection CertificatesCollection =
oX509Store.Certificates.Find(
X509FindType.FindByThumbprint, SearchTerm, true);
....
</code>

Using a breakpoint to iterate through the store (oX509Store) I can
see
that the certificate is there. I have copied all the different
"keys" (thumbprint, subject name, issuer name) from the certificate
to
use as the "SearchTerm" and changing the X509FindType. All the items
I
use fail so that my collection is always 0.

What am I doing wrong?

I am running XP and .NET 2005.

Thanks in advance for any help.

Jose

.



Relevant Pages

  • Finding Certificates
    ... I am trying to find a certificate but I am unable to find the ... "keys" (thumbprint, subject name, issuer name) from the certificate to ... use as the "SearchTerm" and changing the X509FindType. ... use fail so that my collection is always 0. ...
    (microsoft.public.dotnet.security)
  • Re: Win2K certificate chain validity problem
    ... the issuer name and serial number." ... serial number of the subject certificate". ... Our interpretation is that this means "the issuer name and serial number ... Number fields of the Authority Key Identifier extension are populated, ...
    (microsoft.public.win2000.security)
  • Re: Verifying Issuer Certificate
    ... Cert chain validation, as Hao has mentioned below, can be done with the ... You can then check if the issuer certificate ... you have is in the certificate chain returned. ...
    (microsoft.public.platformsdk.security)
  • Re: relation between twin primes and Sophie Germain primes
    ... Some closed great threshold forms years like Rahavan's old certificate. ... harsh nutty tenniss will fail as usual aged ants. ...
    (sci.crypt)
  • Re: Reversed issuer name returned by X509Certificate.GetIssuerName()
    ... The application sends along with the signed XML the ... The business partner uses the issuer name and the serial ... number to find the appropriate certificate in the certificate store. ...
    (microsoft.public.platformsdk.security)