Partager via


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 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 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 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 platform supports the flag PKCS_7_ASN_ENCODING, but Windows CE does not and ignores the flag when it is specified.

Requirements

OS Versions: Windows CE 3.0 and later.
Header: Wincrypt.h.
Link Library: Crypt32.lib.

See Also

CertDuplicateCertificateContext | CertFreeCertificateContext | CertGetIssuerCertificateFromStore | CERT_CONTEXT | CERT_INFO

 Last updated on Thursday, April 08, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.