CertAddEnhancedKeyUsageIdentifier

The CertAddEnhancedKeyUsageIdentifier function adds the usage identifier to the certificate's enhanced key usage property.

#include <wincrypt.h>
BOOL WINAPI CertAddEnhancedKeyUsageIdentifier(
  PCCERT_CONTEXT pCertContext, // in
  LPCSTR pszUsageIdentifier    // in
);
 

Parameters

pCertContext
Specifies the certificate for which the usage identifier is to be added.
pszUsageIdentifier
Specifies the usage identifier to add.

Return Values

TRUE if the function succeeded, FALSE if the function failed.

Call GetLastError to see the reason for any failures.

Example

// EXAMPLE CODE FOR USING CertAddEnhancedKeyUsageIdentifier
// add the usage identifier to the certificate's enhanced key usage
// property

// hash a certificate for which a certificate context has already
// been obtained (pCertContext).
// Set up the variables.
PCCERT_CONTEXT  pCertContext;          // Initialized elsewhere
LPCSTR          pszUsageIdentifier = szOID_RSA_RC4; // in
BOOL            Return;

Return = CertAddEnhancedKeyUsageIdentifier(
          pCertContext,                // the certificate
          pszUsageIdentifier);         // the identifier to add
if (Return) {
 cout<< "function succeeded- usage identifier added "<< endl;
}
else {
 cout<< "function failed "<< endl;
}
 

QuickInfo

  Windows NT: Requires version 4.0 SP3 or later. Available also in IE 3.02 and later.
  Windows: Requires Windows 98 (or Windows 95 with IE 3.02 or later).
  Windows CE: Unsupported.
  Header: Declared in wincrypt.h.
  Import Library: Use crypt32.lib.