Compartilhar via


CertGetSubjectCertificateFromStore

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function returns from a certificate store a subject certificate context uniquely identified by its issuer and serial number.

Syntax

PCCERT_CONTEXT WINAPI CertGetSubjectCertificateFromStore(
  HCERTSTORE hCertStore,
  DWORD dwCertEncodingType,
  PCERT_INFO pCertId
);

Parameters

  • hCertStore
    [in] Handle to a certificate store.
  • dwCertEncodingType
    [in] Specifies the type of encoding used. Currently, only X509_ASN_ENCODING is used; however, additional encoding types may be added in the future.
  • pCertId
    [in] Pointer to a CERT_INFO structure. Only the Issuer and SerialNumber members are used.

Return Value

If the function succeeds, the return value is a pointer to a read-only CERT_CONTEXT. The CERT_CONTEXT structure must be freed by calling the CertFreeCertificateContext function.

The returned certificate might not be valid. Usually, it is verified when using CertGetIssuerCertificateFromStore to get its issuer certificate.

For extended error information, call the GetLastError function.

The GetLastError function can return CRYPT_E_NOT_FOUND, which mean that the subject certificate was not found in the store.

Remarks

The CertDuplicateCertificateContext function can be called to make a duplicate certificate.

The desktop operating system supports the flag PKCS_7_ASN_ENCODING, but Windows Embedded CE does not and ignores the flag when it is specified.

Requirements

Header wincrypt.h
Library crypt32.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

CertDuplicateCertificateContext
CertFreeCertificateContext
CertGetIssuerCertificateFromStore
CERT_CONTEXT
CERT_INFO