Partager via


CertGetSubjectCertificateFromStore (Compact 2013)

3/28/2014

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. Only X509_ASN_ENCODING is used.
  • 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 Compact does not and ignores the flag when it is specified.

Requirements

Header

wincrypt.h

Library

crypt32.lib

See Also

Reference

Certificates Functions
CertDuplicateCertificateContext
CertFreeCertificateContext
CertGetIssuerCertificateFromStore
CERT_CONTEXT
CERT_INFO