CertGetValidUsages function (wincrypt.h)

The CertGetValidUsages function returns an array of usages that consist of the intersection of the valid usages for all certificates in an array of certificates.

Syntax

BOOL CertGetValidUsages(
  [in]      DWORD          cCerts,
  [in]      PCCERT_CONTEXT *rghCerts,
  [out]     int            *cNumOIDs,
  [out]     LPSTR          *rghOIDs,
  [in, out] DWORD          *pcbOIDs
);

Parameters

[in] cCerts

The number of certificates in the array to be checked.

[in] rghCerts

An array of certificates to be checked for valid usage.

[out] cNumOIDs

The number of valid usages found as the intersection of the valid usages of all certificates in the array. If all of the certificates are valid for all usages, cNumOIDs is set to negative one (–1).

[out] rghOIDs

An array of the object identifiers (OIDs) of the valid usages that are shared by all of the certificates in the rghCerts array. This parameter can be NULL to set the size of this structure for memory allocation purposes. For more information, see Retrieving Data of Unknown Length.

[in, out] pcbOIDs

A pointer to a DWORD value that specifies the size, in bytes, of the rghOIDs array and the strings pointed to. When the function returns, the DWORD value contains the number of bytes needed for the array.

Return value

If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. For extended error information, call GetLastError.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps | UWP apps]
Minimum supported server Windows Server 2003 [desktop apps | UWP apps]
Target Platform Windows
Header wincrypt.h
Library Crypt32.lib
DLL Crypt32.dll