IX509EnrollmentHelper::Enroll method (certenroll.h)

The Enroll method enrolls a certificate request and retrieves the issued certificate. This method is web enabled.

Syntax

HRESULT Enroll(
  BSTR               strEnrollmentPolicyServerURI,
  BSTR               strTemplateName,
  EncodingType       Encoding,
  WebEnrollmentFlags enrollFlags,
  BSTR               *pstrCertificate
);

Parameters

strEnrollmentPolicyServerURI

A BSTR that contains the certificate enrollment policy server URL.

strTemplateName

A BSTR variable that contains the Common Name (CN) of the template as it appears in Active Directory or the dotted decimal object identifier.

Encoding

An EncodingType enumeration value that specifies the type of encoding applied to a byte array for display purposes.

enrollFlags

A WebEnrollmentFlags enumeration value that specifies web enrollment behavior. This can be the following value.

Value Meaning
EnrollPrompt
If this flag is set and no authentication credential is available for the certificate enrollment server, the certificate service prompts for a credential. If there is no authentication credential and this flag is not set, the Enroll method fails.

pstrCertificate

A BSTR that contains the issued certificate.

Return value

If the function succeeds, the function returns S_OK.

If the function fails, it returns an HRESULT value that indicates the error. Possible values include, but are not limited to, those in the following table. For a list of common error codes, see Common HRESULT Values.

Return code Description
E_INVALIDARG
The strEnrollmentPolicyServerURI and strTemplateName parameters cannot be NULL.
HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW)
The strEnrollmentPolicyServerURI and strTemplateName parameters exceed 64,000 characters or contain embedded null characters.

Remarks

The Enroll method retrieves the appropriate template, calls InitializeFromTemplate, and then calls Enroll on the IX509Enrollment object.

This method does not installed the issued certificate.

Requirements

   
Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header certenroll.h

See also

IX509EnrollmentHelper