Beispiel #1
0
            /// <summary>
            /// A less error-prone wrapper for CertEnumCertificatesInStore().
            ///
            /// To begin the enumeration, set pCertContext to null. Each iteration replaces pCertContext with
            /// the next certificate in the iteration. The final call sets pCertContext to an invalid SafeCertStoreHandle
            /// and returns "false" to indicate the the end of the store has been reached.
            /// </summary>
            public static unsafe bool CertFindCertificateInStore(SafeCertStoreHandle hCertStore, CertFindType dwFindType, void *pvFindPara, ref SafeCertContextHandle pCertContext)
            {
                CERT_CONTEXT *pPrevCertContext = pCertContext == null ? null : pCertContext.Disconnect();

                pCertContext = CertFindCertificateInStore(hCertStore, CertEncodingType.All, CertFindFlags.None, dwFindType, pvFindPara, pPrevCertContext);
                return(!pCertContext.IsInvalid);
            }
Beispiel #2
0
 /// <summary>
 /// A less error-prone wrapper for CertEnumCertificatesInStore().
 ///
 /// To begin the enumeration, set pCertContext to null. Each iteration replaces pCertContext with
 /// the next certificate in the iteration. The final call sets pCertContext to an invalid SafeCertStoreHandle
 /// and returns "false" to indicate the the end of the store has been reached.
 /// </summary>
 public static bool CertEnumCertificatesInStore(SafeCertStoreHandle hCertStore, ref SafeCertContextHandle pCertContext)
 {
     unsafe
     {
         CERT_CONTEXT *pPrevCertContext = pCertContext == null ? null : pCertContext.Disconnect();
         pCertContext = CertEnumCertificatesInStore(hCertStore, pPrevCertContext);
         return(!pCertContext.IsInvalid);
     }
 }