CertRemoveEnhancedKeyUsageIdentifier

The CertRemoveEnhancedKeyUsageIdentifier function removes the usage identifier from the certificate's enhanced key usage property.

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

Parameters

pCertContext
Specifies the certificate for which the usage identifier is to be removed.
pszUsageIdentifier
Specifies the usage identifier to remove.

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 CertRemoveEnhancedKeyUsageIdentifier.
// Removes the usage identifier from the certificate's enhanced
// key usage property. Assume that a pointer to the certificate
// (pCertContext) for which the identifier is to be removed and
// a pointer to the identifier (pszUsageIdentifier) is already known.

// Set up the variables.
PCCERT_CONTEXT pCertContext;    // Initialized elsewhere
LPCSTR pszUsageIdentifier;      // Initialized elsewhere
BOOL fResult;                   // Returned TRUE if function succeeded
                                //   FALSE if function failed
fResult = CertRemoveEnhancedKeyUsageIdentifier(
            pCertContext,       // in - Pointer to the certificate 
            pszUsageIdentifier);// in - Pointer to the usage
                                //   identifier

if (!fResult) {                 // FALSE
  cout<< "functional failed"<< endl
      << "error code = "<< GetLastError ()<< endl;
}
else {                          // TRUE
  cout<< "function succeeded"<< 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.