CertCreateCertificateContext

Windows CE 3.0

This function creates a certificate context from an encoded certificate. The created context is not persisted to a certificate store. The function makes a copy of the encoded certificate within the created context.

PCCERT_CONTEXT WINAPI CertCreateCertificateContext(
DWORD dwCertEncodingType,
const BYTE *pbCertEncoded,
DWORD cbCertEncoded
);

Parameters

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.
pbCertEncoded
[in] Pointer to a buffer containing the encoded certificate from which the context is to be created.
cbCertEncoded
[in] Size, in bytes, of the pbCertEncoded buffer.

Return Values

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

If the function is unable to decode and create the certificate context, the return value is NULL.

For extended error information, call the GetLastError function. The following table lists a possible error code.

Value Description
E_INVALIDARG An invalid certificate encoding type was specified. Currently, only the X509_ASN_ENCODING type is supported.

Remarks

The CERT_CONTEXT structure must be freed by calling the CertFreeCertificateContext function. The CertDuplicateCertificateContext function can be called to make a duplicate. The CertSetCertificateContextProperty and CertGetCertificateContextProperty functions can be called to store and read properties for the 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, CertGetCertificateContextProperty, CertSetCertificateContextProperty, CERT_CONTEXT


 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.

Show: