CertFindCRLInStore

[This is preliminary documentation and subject to change.]

The CertFindCRLInStore function finds in a certificate store the first or next CRL that matches a search criteria. The search criteria is established by the dwFindType and its associated pvFindPara.

#include <wincrypt.h>
PCCTL_CONTEXT WINAPI CertFindCRLInStore(
  HCERTSTORE hCertStore,                  // in
  DWORD dwMsgAndCertEncodingType,         // in
  DWORD dwFindFlags,                      // in
  DWORD dwFindType,                       // in
  const void *pvFindPara,                 // in
  PCCRL_CONTEXT pPrevCRLContext           // in
);
 

Parameters

hCertStore
Handle to the certificate store to be searched.
dwMsgAndCertEncodingType
Currently not used. It should be set to 0
dwFindFlags
Currently not used. It should be set to 0.
dwFindType
DWORD that establishes the type of search being made. The value of dwFindType determines the data type, contents, and use of the pvFindPara parameter. Currently defined find types and their pvFindPara requirements are:
dwFindType pvFindPara
CRL_FIND_ANY not used. Should be set to NULL
CRL_FIND_ISSUED_BY PCCERT_CONTEXT
CRL_FIND_EXISTING PCCRL_CONTEXT

CRL_FIND_ANY uses no special search criteria. The next CRL in the store is returned.

CRL_FIND_ISSUED_BY searches for the next CRL in the store matching the issuer in the PCCERT_CONTEXT passed in pvFindPara.

CRL_FIND_EXISTING searches for a CRL that is an exact match of the CRL in the PCCRL_CONTEXT pointed to by pvFindPara.

pvFindPara
NULL for CRL_FIND_ANY or a PCERT_CONTEXT for CRL_FIND_ISSUED_BY, or PCCRL_CONTEXT for CRL_FIND_EXISTING.
pPrevCRLContext
Pointer to the last CRL_CONTEXT returned by this function. It must be NULL on the first call of the function. A pPrevCrlContext that is not NULL is always freed by this even if the function causes an error.

Return Values

Pointer to a read-only CRL context is returned. The returned CRL context must be freed by calling CertFreeCRLContext or be implicitly freed when passed as the pPrevCrlContext parameter on a subsequent call to CertFindCRLInStore. If a CRL that matches the search criteria is not found, NULL is returned.

CertDuplicateCRLContext can be called to make a duplicate of the returned context. The returned CRL context may be added to a different certificate store using CertAddCRLContextToStore or a link to that CRL context can be added to a non-collection store using CertAddCRLLinkToStore.

Call GetLastError for the reason for any failures. This function has the following error codes:

Error code Description
E_INVALIDARG The hCertStore argument isn't the same as the hCertStore in the CRL context pointed to by the pPrevCtlContext argument. Invalid find type specified by dwFindType argument.
CRYPT_E_NOT_FOUND No CRLs are in the store, or no CRL was found matching the find criteria, or reached the end of the store's list.

Remarks

The pPrevCRLContext parameter must be NULL to get the first CRL in the store that meets the search criteria. Successive CRLs that meet the find criteria can be found by setting pPrevCRLContext to the PCCRL_CONTEXT pointer returned by a previous call to the function. The find process skips any CRLs that do not match the find criteria or that have been previously deleted by CertDeleteCRLFromStore.

The returned pointer is freed when passed as the pPrevCRLContext parameter on a subsequent call to the function. Otherwise, the pointer must be freed by calling CertFreeCRLContext. A pPrevCRLContext that is not NULL is always freed by this function via a call to CertFreeCRLContext even if there is an error in the function.

Example

See CertFindCertificateInStore. All references to "certificate" should be changed to "CRL."

QuickInfo

  Windows NT: Requires version 5.0 or later.
  Windows: Unsupported.
  Windows CE: Unsupported.
  Header: Declared in wincrypt.h.
  Import Library: Use crypt32.lib.