Edit

Share via


Operations with Certificates

CryptoAPI provides functions to work with certificates, certificate revocation lists (CRLs) and certificate trust lists (CTLs). These include functions for converting encoded types to context types, functions that duplicate objects, and functions that free these objects. These functions encode information into contexts but do not add this context to any store. These functions are CertCreateCertificateContext, CertCreateCRLContext, and CertCreateCTLContext. Use the appropriate CertFree function to free contexts created by one of these functions.

The CryptoAPI functions to duplicate certificates, CRLs, and CTLs increment the reference counter in the specified context and return a pointer to the context. The duplicating functions do not allocate additional space or copy the data from a context into a new memory location. These functions are CertDuplicateCertificateContext, CertDuplicateCRLContext, and CertDuplicateCTLContext. Contexts created with any of these functions must be freed using the appropriate CertFree function.

The CryptoAPI functions that free certificates, CRLs, and CTLs are CertFreeCertificateContext, CertFreeCRLContext, and CertFreeCTLContext. Each of these functions decreases the reference count in a context. If the reference count reaches zero, the memory allocated for the context is released.

For complete lists of functions for working with certificates, CRLs, and CTLs, see Certificate and Certificate Store Maintenance Functions, Certificate Functions, Certificate Revocation List Functions, and Certificate Trust List Functions.