Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function sets the extended key usage (EKU) property for the certificate. Use of this function replaces any EKUs associated with the certificate. To add a single EKU usage without changing existing usages, use the CertAddEnhancedKeyUsageIdentifierfunction. To delete as single EKU usage, use CertRemoveEnhancedKeyUsageIdentifierfunction.

Syntax

BOOL WINAPI CertSetEnhancedKeyUsage(
  PCCERT_CONTEXT 
pCertContext,
  PCERT_ENHKEY_USAGE 
pUsage
);

Parameters

pCertContext

[in] Pointer to the CERT_CONTEXTstructure of the specified certificate.

pUsage

[in] Pointer to a CERT_ENHKEY_USAGEstructure that contains an array of enhanced key usage OIDs to be set as extended properties of the certificate.

Return Value

If the function succeeds, the return value is nonzero, or TRUE.

If the function fails, the return value is zero, or FALSE.

For extended error information, call the GetLastErrorfunction.

Requirements

Header wincrypt.h
Library crypt32.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also