[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ms-cryptoapi
Subject:    Re: Enumerating Certificate Authorities
From:       DolanP () DELUXE-DATA ! CO ! UK
Date:       1998-08-25 9:43:23
[Download RAW message or body]


Scott,

The APIs you want are as follows:

     HCERTSTORE hStore = CertOpenSystemStore(hCryptProv, "CA");     // or
"ROOT"
     PCCERT_CONTEXT pCertContext = NULL;
     char szName[512];

     while (  ( pCertContext = CertEnumCertificatesInStore(hStore,
pCertContext) )  !=  NULL  )
     {
          // Do something with pCertContext.....
          // For example, extract subject details.
          CertNameToStr(
               X509_ASN_ENCODING,
               &pCertContext->pCertInfo->Subject,
               CERT_SIMPLE_NAME_STR,
               szName,
               sizeof(szName) );
     }
     // Should check GetLastError() for possible error....

     CertCloseStore(hStore, CERT_CLOSE_STORE_CHECK_FLAG);

The Cert... functions are all part of the CryptoAPI v2.0 which is available
on the Platform SDK.  This can be found in the MSDN CDs or online at
http://msdn.microsoft.com/developer/sdk/platform.htm.

Regards,
Patrick Dolan.



> Hi,
>
> Can anyone point me at the APIs (or registry entries) required to
enumerate
> the list of trusted certificate authorities (much like Internet Explorer
> does). I assume there is a certificate installed for each of them.
Thanks.
>
>Scott Sanders

----------------------------------------------------------------
Users Guide http://www.microsoft.com/workshop/essentials/mail.asp
contains important info including how to unsubscribe.  Save time, search
the archives at http://discuss.microsoft.com/archives/index.html

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic