IX509Enrollment2::InstallResponse2 method (certenroll.h)
The InstallResponse2 method installs a certificate chain on the end-entity computer. The byte array that contains the response is encoded by using Distinguished Encoding Rules (DER) as defined by the Abstract Syntax Notation One (ASN.1) standard. You must specify the DER-encoded byte array in a string that is either a pure binary sequence or is Unicode encoded. This method is web enabled.
Syntax
HRESULT InstallResponse2(
[in] InstallResponseRestrictionFlags Restrictions,
[in] BSTR strResponse,
[in] EncodingType Encoding,
[in, optional] BSTR strPassword,
[in] BSTR strEnrollmentPolicyServerUrl,
[in] BSTR strEnrollmentPolicyServerID,
[in] PolicyServerUrlFlags EnrollmentPolicyServerFlags,
[in] X509EnrollmentAuthFlags authFlags
);
Parameters
[in] Restrictions
An InstallResponseRestrictionFlags enumeration value that specifies the type of certificates that can be installed. This can be one or more of the following values.
Value | Meaning |
---|---|
|
Do not install untrusted certificates or certificates for which there is no corresponding request. |
|
Create the private key from the certificate response rather than from the dummy certificate. This makes the dummy certificate optional. If this value is not set, the dummy certificate must exist, and the private key is extracted from it. |
|
Install untrusted end entity and certification authority certificates. Certification authority certificates include root and subordinate CA certificates. End entity certificates are installed to the personal store, and CA certificates are installed to the certification authority store. |
|
Perform the same action as the AllowUntrustedCertificate flag but also installs the certificate even if the certificate chain cannot be built because the root is not trusted. Note On Windows Vista, the behavior of this flag is the same as that defined for the AllowUntrustedCertificate flag. You can install an untrusted root beginning with Windows Vista with SP1.
|
[in] strResponse
A BSTR variable that contains the DER-encoded response.
[in] Encoding
An EncodingType enumeration value that specifies the type of encoding applied to the string that contains the DER-encoded response.
[in, optional] strPassword
An optional password for the certificate installation. This can be NULL to indicate that no password is used. When you have finished using the password, clear it from memory by calling the SecureZeroMemory function. For more information about protecting the password, see Handling Passwords.
[in] strEnrollmentPolicyServerUrl
A BSTR that contains the URL of the certificate enrollment policy (CEP) server.
[in] strEnrollmentPolicyServerID
A BSTR that contains an identifier for the CEP server.
[in] EnrollmentPolicyServerFlags
A PolicyServerUrlFlags enumeration value. This can be one of the following values.
[in] authFlags
An X509EnrollmentAuthFlags enumeration value that specifies the client authentication type. For Windows 7, only X509AuthCertificate can be chosen from the following values.
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 |
---|---|
|
This method was called from the web and either AllowNoOutstandingRequest or AllowUntrustedCertificate was specified in the Restrictions parameter. |
|
The length of the string that contains the password exceeds 64 kilobytes. |
|
The enrollment object has not been initialized. |
Remarks
The InstallResponse2 method:
- Retrieves the dummy certificate from the external store.
- Retrieves the certificate contained in the response and installs it on the computer.
- Copies properties from the dummy certificate in the external store onto the newly installed certificate in the personal store.
Before calling the InstallResponse2 method, you must initialize the IX509Enrollment object by calling one of the following methods.
If you call this method from the web, you can specify only AllowNone or AllowUntrustedRoot in the Restrictions parameter. If you specify AllowNoOutstandingRequest or AllowUntrustedCertificate, the method returns an E_ACCESSDENIED error.
The last four parameters (strEnrollmentPolicyServerUrl, strEnrollmentPolicyServerID, EnrollmentPolicyServerFlags, and authFlags) are not included in the InstallResponse method. They enable you to add a property value to the installed certificate in much the same way as the ICertPropertyEnrollmentPolicyServer interface does.
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 |