Export (0) Print
Expand All
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

CertGetEnhancedKeyUsage

Windows CE 3.0

This function returns information from the EKU extension or the EKU extended property of a certificate. EKUs indicate valid uses of the certificate.

BOOL WINAPI CertGetEnhancedKeyUsage(
PCCERT_CONTEXT pCertContext,
DWORD dwFlags,
PCERT_ENHKEY_USAGE pUsage,
DWORD *pcbUsage
);

Parameters

pCertContext
[in] Pointer to a CERT_CONTEXT structure certificate context.
dwFlags
[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.

Return Values

If the function succeeds, the return value is nonzero (TRUE).

If the function fails, the return value is zero (FALSE).

For extended error information, call the GetLastError function.

Remarks

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.

See Also

CertSetEnhancedKeyUsage, CERT_CONTEXT, CERT_ENHKEY_USAGE


 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.

Show:
© 2015 Microsoft