CERT_CONTEXT structure (wincrypt.h)

The CERT_CONTEXT structure contains both the encoded and decoded representations of a certificate. A certificate context returned by one of the functions defined in Wincrypt.h must be freed by calling the CertFreeCertificateContext function. The CertDuplicateCertificateContext function can be called to make a duplicate copy (which also must be freed by calling CertFreeCertificateContext).

Syntax

typedef struct _CERT_CONTEXT {
  DWORD      dwCertEncodingType;
  BYTE       *pbCertEncoded;
  DWORD      cbCertEncoded;
  PCERT_INFO pCertInfo;
  HCERTSTORE hCertStore;
} CERT_CONTEXT, *PCERT_CONTEXT;

Members

dwCertEncodingType

Type of encoding used. It is always acceptable to specify both the certificate and message encoding types by combining them with a bitwise-OR operation as shown in the following example:

X509_ASN_ENCODING | PKCS_7_ASN_ENCODING Currently defined encoding types are:

  • X509_ASN_ENCODING
  • PKCS_7_ASN_ENCODING

pbCertEncoded

A pointer to a buffer that contains the encoded certificate.

cbCertEncoded

The size, in bytes, of the encoded certificate.

pCertInfo

The address of a CERT_INFO structure that contains the certificate information.

hCertStore

A handle to the certificate store that contains the certificate context.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Header wincrypt.h

See also

CERT_INFO

CRYPT_SIGN_MESSAGE_PARA

CRYPT_VERIFY_MESSAGE_PARA

CertAddCertificateContextToStore

CertAddEncodedCertificateToStore

CertCreateCertificateContext

CertEnumCertificatesInStore

CertFindCertificateInStore

CertFreeCertificateContext

CertGetIssuerCertificateFromStore

CertGetSubjectCertificateFromStore

CertVerifyRevocation

CryptVerifyMessageSignature