CertGetSubjectCertificateFromStore

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

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

Parameters

  • hCertStore
    [in] Handle of 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 Values

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 following table lists one possible error code.

Value Description
CRYPT_E_NOT_FOUND The subject certificate was not found in the store.

Remarks

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

The desktop platform supports the PKCS_7_ASN_ENCODING flag, but Windows CE does not. Windows CE ignores the flag when it is specified.

Requirements

Runs on Versions Defined in Include Link to
Windows CE OS 3.0 or later Wincrypt.h   Crypt32.lib

Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

CertDuplicateCertificateContext, CertFreeCertificateContext, CertGetIssuerCertificateFromStore, CERT_CONTEXT, CERT_INFO

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.