IX509Enrollment2::InitializeFromTemplate method (certenroll.h)
The InitializeFromTemplate method initializes the enrollment object by using a template.
Syntax
HRESULT InitializeFromTemplate(
[in] X509CertificateEnrollmentContext context,
[in] IX509EnrollmentPolicyServer *pPolicyServer,
[in] IX509CertificateTemplate *pTemplate
);
Parameters
[in] context
An X509CertificateEnrollmentContext enumeration value that indicates whether the requested enrollment is for a user, a computer, or an administrator acting on behalf of a computer. This can be one of the following values.
[in] pPolicyServer
Pointer to an IX509EnrollmentPolicyServer object that represents the certificate enrollment policy (CEP) server that contains the template specified by the pTemplate parameter.
[in] pTemplate
Pointer to an IX509CertificateTemplate object that represents the template to use during initialization.
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/value | Description |
---|---|
|
The pPolicyServer and pTemplate parameters cannot be NULL. |
|
The enrollment object has already been initialized. |
Remarks
The InitializeFromTemplate method:
- Examines the template to determine the type of request needed.
- Creates the appropriate type of request object (PKCS #10, PKCS #7, or CMC).
- Sets the following properties on the request if values currently exist:
- Initializes the request object by using the template.
- Retrieves the signature count, issuance policies, and application policies from the template.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 7 [desktop apps only] |
Minimum supported server | Windows Server 2008 R2 [desktop apps only] |
Target Platform | Windows |
Header | certenroll.h |