This topic has not yet been rated - Rate this topic

CertCreateCTLContext function

Applies to: desktop apps only

The CertCreateCTLContext function creates a certificate trust list (CTL) context from an encoded CTL. The created context is not persisted to a certificate store. The function makes a copy of the encoded CTL within the created context.

Syntax

PCCTL_CONTEXT WINAPI CertCreateCTLContext(
  __in  DWORD dwMsgAndCertEncodingType,
  __in  const BYTE *pbCtlEncoded,
  __in  DWORD cbCtlEncoded
);

Parameters

dwMsgAndCertEncodingType [in]

Specifies the type of encoding used. Both the certificate and message encoding types must be specified 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
pbCtlEncoded [in]

A pointer to a buffer containing the encoded CTL from which the context is to be created.

cbCtlEncoded [in]

The size, in bytes, of the pbCtlEncoded buffer.

Return value

If the function succeeds, the return value is a pointer to a read-only CTL_CONTEXT.

If the function fails and is unable to decode and create the CTL_CONTEXT, the return value is NULL. For extended error information, call GetLastError. The following table shows a possible error code.

Return codeDescription
E_INVALIDARG

Invalid certificate encoding type. Only PKCS_7_ASN_ENCODING and X509_ASN_ENCODING are supported.

 

If the function fails, GetLastError may return an Abstract Syntax Notation One (ASN.1) encoding/decoding error. For information about these errors, see ASN.1 Encoding/Decoding Return Values.

Remarks

The CTL_CONTEXT must be freed by calling CertFreeCTLContext. CertDuplicateCTLContext can be called to make a duplicate. CertSetCTLContextProperty and CertGetCTLContextProperty can be called to store and read properties for the CTL.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Wincrypt.h

Library

Crypt32.lib

DLL

Crypt32.dll

See also

Certificate Trust List Functions
CertCreateCertificateContext
CertCreateCRLContext
CertDuplicateCTLContext
CertFreeCTLContext
CertGetCTLContextProperty
CertSetCTLContextProperty
CTL_CONTEXT

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ