see sharp RSS 2.0
# Tuesday, 26 May 2009

Alejandro Campos Magencio has written a nice post on how to import a certificate without user interaction:

http://blogs.msdn.com/alejacma/archive/2008/01/31/how-to-import-a-certificate-without-user-interaction-c-c.aspx

It is built around CryptUIWizImport which is described here: http://msdn.microsoft.com/en-us/library/aa380598.aspx

Be sure to check all flags available:

 

Value Meaning
CRYPTUI_WIZ_NO_UI
0x0001

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.

CRYPTUI_WIZ_IGNORE_NO_UI_FLAG_FOR_CSPS
0x0002

Suppress all user interfaces generated by cryptographic service providers (CSPs). This option can be overridden by the CRYPTUI_WIZ_NO_UI_EXCEPT_CSP option.

CRYPTUI_WIZ_NO_UI_EXCEPT_CSP
0x0003

Suppress all user interfaces except those generated by CSPs. This option overrides the CRYPTUI_WIZ_IGNORE_NO_UI_FLAG_FOR_CSPS option.

CRYPTUI_WIZ_IMPORT_ALLOW_CERT
0x00020000

Allow certificates to be imported.

CRYPTUI_WIZ_IMPORT_ALLOW_CRL
0x00040000

Allow CRLs to be imported.

CRYPTUI_WIZ_IMPORT_ALLOW_CTL
0x00080000

Allow CTLs to be imported.

CRYPTUI_WIZ_IMPORT_NO_CHANGE_DEST_STORE
0x00010000

Do not allow the user to change the destination certificate store represented by the hDestCertStore parameter.

CRYPTUI_WIZ_IMPORT_TO_LOCALMACHINE
0x00100000

Import the object to the certificate store for the local computer. This applies only to Personal Information Exchange (PFX) imports.

CRYPTUI_WIZ_IMPORT_TO_CURRENTUSER
0x00200000

Import the object to the certificate store for the current user. This applies only to PFX imports.

CRYPTUI_WIZ_IMPORT_REMOTE_DEST_STORE
0x00400000

Import the object to a remote certificate store. Set this flag if the hDestCertStore parameter represents a remote certificate store.


Tuesday, 26 May 2009 20:04:39 (Mitteleuropäische Sommerzeit, UTC+02:00)  #    -
C# | CAPI | Certificates
Archive
<2009 May>
SunMonTueWedThuFriSat
262728293012
3456789
10111213141516
17181920212223
24252627282930
31123456
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
Any link on this site may lead to an external website that is not under my control and that external website might show an opinion that is not mine.

© Copyright 2017
Hannes Köhler
Sign In
Statistics
Total Posts: 39
This Year: 0
This Month: 0
This Week: 0
Comments: 1
All Content © 2017, Hannes Köhler
DasBlog theme 'Business' created by Christoph De Baene (delarou)