[in] Indicates whether the function will report on a certificate's extensions, its extended properties, or both. If set to zero, the function returns the valid uses of a certificate based on both the certificate's EKU extension and its EKU extended property value.

To return only the EKU extension or EKU property value, the following flags can be set.

Value

Description

CERT_FIND_EXT_ONLY_ENHKEY_USAGE_FLAG

Gets only the extension.

CERT_FIND_PROP_ONLY_ENHKEY_USAGE_FLAG

Gets only the extended property value.

pUsage

[out] Pointer to receive a CERT_ENHKEY_USAGE structure indicating the valid uses of the certificate.

This parameter can be NULL to set the size of the key usage for memory allocation purposes.

pcbUsage

[in/out] Pointer to a DWORD that specifies the size, in bytes, of the structure pointed to by the pUsage parameter. When the function returns, the DWORD contains the size in bytes of the structure.

If a certificate has an EKU extension, that extension lists OIDs for valid uses of that certificate. In a Microsoft environment, a certificate might also have EKU extended properties specifying valid uses for the certificate.

If a certificate has neither an EKU extension nor EKU extended properties, it is assumed to be valid for all uses.

If a certificate has either an EKU extension or EKU extended properties but not both, it is valid only for the uses indicated in the extension or extended properties that it has.

If a certificate has both an EKU extension and EKU extended properties, it is valid only for the uses that are on both lists.

If the dwFlags parameter is set to zero, the cUsageIdentifier member of the CERT_ENHKEY_USAGE structure is set to the number of valid uses of the certificate determined by the value of both the EKU extension and the EKU extended property value.

If the cUsageIdentifier member is zero, the certificate might be valid for all uses or the certificate might have no valid uses. The return from a call to the GetLastError function can be used to determine whether the certificate is good for all uses or for no uses. If GetLastError returns CRYPT_E_NOT_FOUND, the certificate is good for all uses. If it returns zero, the certificate has no valid uses.

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.