CryptUIWizImport function (cryptuiapi.h)
The function imports a certificate, a certificate trust list (CTL), a certificate revocation list (CRL), or a certificate store to a certificate store. The import can be performed with or without user interaction.
BOOL CryptUIWizImport( DWORD dwFlags, HWND hwndParent, LPCWSTR pwszWizardTitle, PCCRYPTUI_WIZ_IMPORT_SRC_INFO pImportSrc, HCERTSTORE hDestCertStore );
Contains flags that modify the behavior of the function. This can be zero or a combination of one or more of the following values.
This function will perform the import based on the information in the CRYPTUI_WIZ_IMPORT_SRC_INFO structure pointed to by pImportSrc into the store specified by hDestCertStore without displaying any user interface. If this flag is not specified, this function will display a wizard to guide the user through the import process.
Beginning with Windows 8 and Windows Server 2012, if you set this flag and are importing a certificate from a PFX BLOB that was protected to an Active Directory (AD) principal, and the current user, as part of that principal, has permission to decrypt the password embedded in the PFX packet, the importation will succeed without requiring that a password be set in the CRYPTUI_WIZ_IMPORT_SRC_INFO structure. For more information about protecting PFX to an AD principal, see the pvPara parameter and the PKCS12_PROTECT_TO_DOMAIN_SIDS flag of the PFXExportCertStoreEx function.
||Suppress all user interfaces generated by cryptographic service providers (CSPs). This option can be overridden by the CRYPTUI_WIZ_NO_UI_EXCEPT_CSP option.|
||Suppress all user interfaces except those generated by CSPs. This option overrides the CRYPTUI_WIZ_IGNORE_NO_UI_FLAG_FOR_CSPS option.|
||Allow certificates to be imported.|
||Allow CRLs to be imported.|
||Allow CTLs to be imported.|
||Do not allow the user to change the destination certificate store represented by the hDestCertStore parameter.|
||Import the object to the certificate store for the local computer. This applies only to Personal Information Exchange (PFX) imports.|
||Import the object to the certificate store for the current user. This applies only to PFX imports.|
||Import the object to a remote certificate store. Set this flag if the hDestCertStore parameter represents a remote certificate store.|
The handle of the window to use as the parent of the dialog box that this function creates. This parameter is ignored if the CRYPTUI_WIZ_NO_UI flag is set in dwFlags.
A pointer to a null-terminated Unicode string that contains the title to use in the dialog box that this function creates. This parameter is ignored if the CRYPTUI_WIZ_NO_UI flag is set in dwFlags.
A pointer to a CRYPTUI_WIZ_IMPORT_SRC_INFO structure that contains information about the object to import. This parameter is required if CRYPTUI_WIZ_NO_UI is set in dwFlags and is optional otherwise.
A handle to the certificate store to import to. If this parameter is NULL and the CRYPTUI_WIZ_NO_UI flag is not set in dwFlags, the wizard will prompt the user to select a certificate store.
If the function succeeds, the function returns nonzero.
If the function fails, it returns zero. For extended error information, call the GetLastError function.
If none of following three flags are set in dwFlags, import of any type of content is allowed:
- The private key in the PFX BLOB will be forced to be imported into the current user store.
- And if CRYPTUI_WIZ_NO_UI is not set, the wizard prompts the user to select a certificate store from among the current user certificate stores.
|Minimum supported client||Windows XP [desktop apps only]|
|Minimum supported server||Windows Server 2003 [desktop apps only]|