CertCreateCertificateContext (Windows CE 5.0)

Send Feedback

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(DWORDdwCertEncodingType,const BYTE* pbCertEncoded,DWORDcbCertEncoded);

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 GetLastError function can return E_INVALIDARG, which mean that 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 operating system 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 | CertGetCertificateContextProperty | CertSetCertificateContextProperty | CERT_CONTEXT

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.