ICertSrvSetup::CAImportPFX method (casetup.h)

The CAImportPFX method imports a certification authority (CA) certificate and its associated private key into the local computer store. This method does not change the state of the CCertSrvSetup object.

Syntax

HRESULT CAImportPFX(
  [in]  const BSTR                  bstrFileName,
  [in]  const BSTR                  bstrPasswd,
  [in]  VARIANT_BOOL                bOverwriteExistingKey,
  [out] ICertSrvSetupKeyInformation **ppVal
);

Parameters

[in] bstrFileName

A string that contains the name of a PFX file used to import a private key.

[in] bstrPasswd

A string that contains a password for the PFX file.

[in] bOverwriteExistingKey

A value that indicates whether to overwrite an existing key of the same name.

[out] ppVal

The address of a pointer to an ICertSrvSetupKeyInformation interface that can be used to set properties of the imported private key.

Return value

None

Remarks

The CAImportPFX method uses the input parameters to decrypt and decode a PFX file and then installs the key and certificate in the local computer store. If the certificate satisfies the following criteria and after installation of the key, the method returns an ICertSrvSetupKeyInformation object to the caller.

  • Contains an AT_SIGNATURE key that matches the key in the private key container.
  • Is self-signed or has basic constraints for a CA.
  • Passes chain validation but might have an offline revocation error.
If the PFX file contains multiple certificates and keys, CAImportPFX installs all of the certificates and keys; however, the returned ICertSrvSetupKeyInformation object only contains properties of the last CA certificate in the file. When the caller finishes using the ICertSrvSetupKeyInformation object, the caller must release it by using the Release method.

Requirements

Requirement Value
Minimum supported client None supported
Minimum supported server Windows ServerĀ 2008 [desktop apps only]
Target Platform Windows
Header casetup.h
DLL Certocm.dll

See also

ICertSrvSetup