CertCreateCertificateContext (Compact 2013)
3/28/2014
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.
Syntax
PCCERT_CONTEXT WINAPI CertCreateCertificateContext(
DWORD dwCertEncodingType,
const BYTE* pbCertEncoded,
DWORD cbCertEncoded
);
Parameters
- dwCertEncodingType
[in] Specifies the type of encoding used. Only X509_ASN_ENCODING is used.
- 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 Value
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 Embedded Compact does not and ignores the flag when it is specified.
Requirements
Header |
wincrypt.h |
Library |
crypt32.lib |
See Also
Reference
Certificates Functions
CertDuplicateCertificateContext
CertFreeCertificateContext
CertGetCertificateContextProperty
CertSetCertificateContextProperty
CERT_CONTEXT