Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2248 lines
118 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1997.
  5. //
  6. // File: cryptui.h
  7. //
  8. // Contents: Common Cryptographic Dialog API Prototypes and Definitions
  9. //
  10. //----------------------------------------------------------------------------
  11. #ifndef __CRYPTUI_H__
  12. #define __CRYPTUI_H__
  13. #if defined (_MSC_VER) && (_MSC_VER >= 1020)
  14. #pragma once
  15. #endif
  16. #include <prsht.h>
  17. #include <wintrust.h>
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. #pragma pack(8)
  22. /////////////////////////////////////////////////////////////////////////////////////////////////////
  23. //
  24. // the functions which return property sheet pages take this callback as one of the parameters in
  25. // the input structure. it is then called when each page is about to be created and when each page
  26. // is about to be destroyed. the messages are PSPCB_CREATE when a page is about to be created and
  27. // PSPCB_RELEASE when a page is about to be destroyed. the pvCallbackData parameter in the callback
  28. // is the pvoid that was passed in with the callback in the input structure.
  29. typedef BOOL (WINAPI * PFNCPROPPAGECALLBACK)(
  30. HWND hWndPropPage,
  31. UINT uMsg,
  32. void *pvCallbackData);
  33. /////////////////////////////////////////////////////////////////////////////////////////////////////
  34. //
  35. // dwSize size of this struct
  36. // hwndParent parent of this dialog (OPTIONAL)
  37. // dwFlags flags, may a combination of any of the flags below (OPTIONAL)
  38. // szTitle title for the window (OPTIONAL)
  39. // pCertContext the cert context that is to be displayed
  40. // rgszPurposes array of purposes that this cert is to be validated for (OPTIONAL)
  41. // cPurposes number of purposes (OPTIONAL)
  42. // pCryptProviderData/hWVTStateData if WinVerifyTrust has already been called for the cert (OPTIONAL)
  43. // then pass in a pointer to the state struct that was
  44. // acquired through a call to WTHelperProvDataFromStateData(),
  45. // or pass in the hWVTStateData of the WINTRUST_DATA struct
  46. // if WTHelperProvDataFromStateData() was not called.
  47. // if pCryptProviderData/hWVTStateData is used then
  48. // fpCryptProviderDataTrustedUsage, idxSigner, idxCert, and
  49. // fCounterSignature must be set
  50. // fpCryptProviderDataTrustedUsage if WinVerifyTrust was called this is the result of whether (OPTIONAL)
  51. // the cert was trusted
  52. // idxSigner the index of the signer to view (OPTIONAL)
  53. // idxCert the index of the cert that is being viewed within the (OPTIONAL)
  54. // signer chain. the cert context of this cert MUST match
  55. // pCertContext
  56. // fCounterSigner set to TRUE if a counter signature is being viewed. if (OPTIONAL)
  57. // this is TRUE then idxCounterSigner must be valid
  58. // idxCounterSigner the index of the counter signer to view (OPTIONAL)
  59. // cStores Count of other stores to search when building and (OPTIONAL)
  60. // validating chain
  61. // rghStores Array of other stores to search when buliding and (OPTIONAL)
  62. // validating chain
  63. // cPropSheetPages number of extra pages to add to the dialog. (OPTIONAL)
  64. // rgPropSheetPages extra pages to add to the dialog. (OPTIONAL)
  65. // each page in this array will NOT recieve the lParam in
  66. // the PROPSHEET structure as the lParam in the
  67. // WM_INITDIALOG, instead it will receive a pointer to a
  68. // CRYPTUI_INITDIALOG_STRUCT (defined below) which contains
  69. // the lParam in the PROPSSHEET structure AND the
  70. // PCCERT_CONTEXT for which the page is being displayed.
  71. // nStartPage this is the index of the initial page that will be
  72. // displayed. if the upper most bit (0x8000) is set then
  73. // the index is assumed to index rgPropSheetPages
  74. // (after the upper most bit has been stripped off. eg.
  75. // 0x8000 will indicate the first page in rgPropSheetPages),
  76. // if the upper most bit is 0 then nStartPage will be the
  77. // starting index of the default certificate dialog pages.
  78. //
  79. /////////////////////////////////////////////////////////////////////////////////////////////////////
  80. // dwFlags
  81. #define CRYPTUI_HIDE_HIERARCHYPAGE 0x00000001
  82. #define CRYPTUI_HIDE_DETAILPAGE 0x00000002
  83. #define CRYPTUI_DISABLE_EDITPROPERTIES 0x00000004
  84. #define CRYPTUI_ENABLE_EDITPROPERTIES 0x00000008
  85. #define CRYPTUI_DISABLE_ADDTOSTORE 0x00000010
  86. #define CRYPTUI_ENABLE_ADDTOSTORE 0x00000020
  87. #define CRYPTUI_ACCEPT_DECLINE_STYLE 0x00000040
  88. #define CRYPTUI_IGNORE_UNTRUSTED_ROOT 0x00000080
  89. #define CRYPTUI_DONT_OPEN_STORES 0x00000100
  90. #define CRYPTUI_ONLY_OPEN_ROOT_STORE 0x00000200
  91. #define CRYPTUI_WARN_UNTRUSTED_ROOT 0x00000400 // For use with viewing of certificates on remote
  92. // machines only. If this flag is used rghStores[0]
  93. // must be the handle of the root store on the remote machine.
  94. typedef struct tagCRYPTUI_VIEWCERTIFICATE_STRUCTW {
  95. DWORD dwSize;
  96. HWND hwndParent; // OPTIONAL
  97. DWORD dwFlags; // OPTIONAL
  98. LPCWSTR szTitle; // OPTIONAL
  99. PCCERT_CONTEXT pCertContext;
  100. LPCSTR * rgszPurposes; // OPTIONAL
  101. DWORD cPurposes; // OPTIONAL
  102. union
  103. {
  104. CRYPT_PROVIDER_DATA const * pCryptProviderData; // OPTIONAL
  105. HANDLE hWVTStateData; // OPTIONAL
  106. };
  107. BOOL fpCryptProviderDataTrustedUsage;// OPTIONAL
  108. DWORD idxSigner; // OPTIONAL
  109. DWORD idxCert; // OPTIONAL
  110. BOOL fCounterSigner; // OPTIONAL
  111. DWORD idxCounterSigner; // OPTIONAL
  112. DWORD cStores; // OPTIONAL
  113. HCERTSTORE * rghStores; // OPTIONAL
  114. DWORD cPropSheetPages; // OPTIONAL
  115. LPCPROPSHEETPAGEW rgPropSheetPages; // OPTIONAL
  116. DWORD nStartPage;
  117. } CRYPTUI_VIEWCERTIFICATE_STRUCTW, *PCRYPTUI_VIEWCERTIFICATE_STRUCTW;
  118. typedef const CRYPTUI_VIEWCERTIFICATE_STRUCTW *PCCRYPTUI_VIEWCERTIFICATE_STRUCTW;
  119. typedef struct tagCRYPTUI_VIEWCERTIFICATE_STRUCTA {
  120. DWORD dwSize;
  121. HWND hwndParent; // OPTIONAL
  122. DWORD dwFlags; // OPTIONAL
  123. LPCSTR szTitle; // OPTIONAL
  124. PCCERT_CONTEXT pCertContext;
  125. LPCSTR * rgszPurposes; // OPTIONAL
  126. DWORD cPurposes; // OPTIONAL
  127. union
  128. {
  129. CRYPT_PROVIDER_DATA const * pCryptProviderData; // OPTIONAL
  130. HANDLE hWVTStateData; // OPTIONAL
  131. };
  132. BOOL fpCryptProviderDataTrustedUsage;// OPTIONAL
  133. DWORD idxSigner; // OPTIONAL
  134. DWORD idxCert; // OPTIONAL
  135. BOOL fCounterSigner; // OPTIONAL
  136. DWORD idxCounterSigner; // OPTIONAL
  137. DWORD cStores; // OPTIONAL
  138. HCERTSTORE * rghStores; // OPTIONAL
  139. DWORD cPropSheetPages; // OPTIONAL
  140. LPCPROPSHEETPAGEA rgPropSheetPages; // OPTIONAL
  141. DWORD nStartPage;
  142. } CRYPTUI_VIEWCERTIFICATE_STRUCTA, *PCRYPTUI_VIEWCERTIFICATE_STRUCTA;
  143. typedef const CRYPTUI_VIEWCERTIFICATE_STRUCTA *PCCRYPTUI_VIEWCERTIFICATE_STRUCTA;
  144. //
  145. // pfPropertiesChanged this will be set by the dialog proc to inform the caller
  146. // if any properties have been changed on certs in the chain
  147. // while the dialog was open
  148. //
  149. BOOL
  150. WINAPI
  151. CryptUIDlgViewCertificateW(
  152. IN PCCRYPTUI_VIEWCERTIFICATE_STRUCTW pCertViewInfo,
  153. OUT BOOL *pfPropertiesChanged // OPTIONAL
  154. );
  155. BOOL
  156. WINAPI
  157. CryptUIDlgViewCertificateA(
  158. IN PCCRYPTUI_VIEWCERTIFICATE_STRUCTA pCertViewInfo,
  159. OUT BOOL *pfPropertiesChanged // OPTIONAL
  160. );
  161. #ifdef UNICODE
  162. #define CryptUIDlgViewCertificate CryptUIDlgViewCertificateW
  163. #define PCRYPTUI_VIEWCERTIFICATE_STRUCT PCRYPTUI_VIEWCERTIFICATE_STRUCTW
  164. #define CRYPTUI_VIEWCERTIFICATE_STRUCT CRYPTUI_VIEWCERTIFICATE_STRUCTW
  165. #define PCCRYPTUI_VIEWCERTIFICATE_STRUCT PCCRYPTUI_VIEWCERTIFICATE_STRUCTW
  166. #else
  167. #define CryptUIDlgViewCertificate CryptUIDlgViewCertificateA
  168. #define PCRYPTUI_VIEWCERTIFICATE_STRUCT PCRYPTUI_VIEWCERTIFICATE_STRUCTA
  169. #define CRYPTUI_VIEWCERTIFICATE_STRUCT CRYPTUI_VIEWCERTIFICATE_STRUCTA
  170. #define PCCRYPTUI_VIEWCERTIFICATE_STRUCT PCCRYPTUI_VIEWCERTIFICATE_STRUCTA
  171. #endif
  172. //
  173. // this struct is passed as the lParam in the WM_INITDIALOG call to each
  174. // property sheet that is in the rgPropSheetPages array of the
  175. // CRYPTUI_VIEWCERTIFICATE_STRUCT structure
  176. //
  177. typedef struct tagCRYPTUI_INITDIALOG_STRUCT {
  178. LPARAM lParam;
  179. PCCERT_CONTEXT pCertContext;
  180. } CRYPTUI_INITDIALOG_STRUCT, *PCRYPTUI_INITDIALOG_STRUCT;
  181. //
  182. // this structure is used in CRYPTUI_VIEWCERTIFICATEPROPERTIES_STRUCT,
  183. // and allows users of MMC to recieve notifications that properties
  184. // on certificates have changed
  185. //
  186. typedef HRESULT (__stdcall * PFNCMMCCALLBACK)(LONG_PTR lNotifyHandle, LPARAM param);
  187. typedef struct tagCRYPTUI_MMCCALLBACK_STRUCT {
  188. PFNCMMCCALLBACK pfnCallback; // the address of MMCPropertyChangeNotify()
  189. LONG_PTR lNotifyHandle; // the lNotifyHandle passed to MMCPropertyChangeNotify()
  190. LPARAM param; // the param passed to MMCPropertyChangeNotify()
  191. } CRYPTUI_MMCCALLBACK_STRUCT, *PCRYPTUI_MMCCALLBACK_STRUCT;
  192. /////////////////////////////////////////////////////////////////////////////////////////////////////
  193. //
  194. // dwSize size of this struct
  195. // hwndParent parent of this dialog (OPTIONAL)
  196. // dwFlags flags, must be set to 0
  197. // union the szTitle field of the union is only valid if
  198. // CryptUIDlgViewCertificateProperties is being called.
  199. // the pMMCCallback field of the union is only valid if
  200. // CryptUIGetCertificatePropertiesPages is being called.
  201. // Note that if pMMCCallback is non-NULL and
  202. // CryptUIGetCertificatePropertiesPages was called, the
  203. // struct pointed to by pMMCCallback will not be referenced
  204. // by cryptui.dll after the callback has been made to MMC.
  205. // this will allow the original caller of
  206. // CryptUIGetCertificatePropertiesPages to free the struct
  207. // pointed to by pMMCCallback in the actual callback.
  208. // szTitle title for the window (OPTIONAL)
  209. // pMMCCallback this structure is used to callback MMC if properties (OPTIONAL)
  210. // have changed
  211. // pCertContext the cert context that is to be displayed
  212. // pPropPageCallback this callback will be called when each page that is (OPTIONAL)
  213. // returned in the CryptUIGetCertificatePropertiesPages call
  214. // is about to be created or destroyed. if this is NULL no
  215. // callback is made. Note that this is not used if
  216. // CryptUIDlgViewCertificateProperties is called
  217. // pvCallbackData this is uniterpreted data that is passed back when the (OPTIONAL)
  218. // when pPropPageCallback is made
  219. // cStores Count of other stores to search when building and (OPTIONAL)
  220. // validating chain
  221. // rghStores Array of other stores to search when buliding and (OPTIONAL)
  222. // validating chain
  223. // cPropSheetPages number of extra pages to add to the dialog (OPTIONAL)
  224. // rgPropSheetPages extra pages to add to the dialog (OPTIONAL)
  225. //
  226. /////////////////////////////////////////////////////////////////////////////////////////////////////
  227. typedef struct tagCRYPTUI_VIEWCERTIFICATEPROPERTIES_STRUCTW {
  228. DWORD dwSize;
  229. HWND hwndParent; // OPTIONAL
  230. DWORD dwFlags; // OPTIONAL
  231. union
  232. {
  233. LPCWSTR szTitle; // OPTIONAL
  234. PCRYPTUI_MMCCALLBACK_STRUCT pMMCCallback;// OPTIONAL
  235. };
  236. PCCERT_CONTEXT pCertContext;
  237. PFNCPROPPAGECALLBACK pPropPageCallback; // OPTIONAL
  238. void * pvCallbackData; // OPTIONAL
  239. DWORD cStores; // OPTIONAL
  240. HCERTSTORE * rghStores; // OPTIONAL
  241. DWORD cPropSheetPages; // OPTIONAL
  242. LPCPROPSHEETPAGEW rgPropSheetPages; // OPTIONAL
  243. } CRYPTUI_VIEWCERTIFICATEPROPERTIES_STRUCTW, *PCRYPTUI_VIEWCERTIFICATEPROPERTIES_STRUCTW;
  244. typedef const CRYPTUI_VIEWCERTIFICATEPROPERTIES_STRUCTW *PCCRYPTUI_VIEWCERTIFICATEPROPERTIES_STRUCTW;
  245. typedef struct tagCRYPTUI_VIEWCERTIFICATEPROPERTIES_STRUCTA {
  246. DWORD dwSize;
  247. HWND hwndParent; // OPTIONAL
  248. DWORD dwFlags; // OPTIONAL
  249. union
  250. {
  251. LPCSTR szTitle; // OPTIONAL
  252. PCRYPTUI_MMCCALLBACK_STRUCT pMMCCallback;// OPTIONAL
  253. };
  254. PCCERT_CONTEXT pCertContext;
  255. PFNCPROPPAGECALLBACK pPropPageCallback; // OPTIONAL
  256. void * pvCallbackData; // OPTIONAL
  257. DWORD cStores; // OPTIONAL
  258. HCERTSTORE * rghStores; // OPTIONAL
  259. DWORD cPropSheetPages; // OPTIONAL
  260. LPCPROPSHEETPAGEA rgPropSheetPages; // OPTIONAL
  261. } CRYPTUI_VIEWCERTIFICATEPROPERTIES_STRUCTA, *PCRYPTUI_VIEWCERTIFICATEPROPERTIES_STRUCTA;
  262. typedef const CRYPTUI_VIEWCERTIFICATEPROPERTIES_STRUCTA *PCCRYPTUI_VIEWCERTIFICATEPROPERTIES_STRUCTA;
  263. // pfPropertiesChanged this will be set by the dialog proc to inform the caller
  264. // if any properties have been changed on certs in the chain
  265. // while the dialog was open
  266. BOOL
  267. WINAPI
  268. CryptUIDlgViewCertificatePropertiesW(
  269. IN PCCRYPTUI_VIEWCERTIFICATEPROPERTIES_STRUCTW pcsp,
  270. OUT BOOL *pfPropertiesChanged // OPTIONAL
  271. );
  272. BOOL
  273. WINAPI
  274. CryptUIDlgViewCertificatePropertiesA(
  275. IN PCCRYPTUI_VIEWCERTIFICATEPROPERTIES_STRUCTA pcsp,
  276. OUT BOOL *pfPropertiesChanged // OPTIONAL
  277. );
  278. // NOTE!! when calling this function, the following parameters of the
  279. // CRYPTUI_VIEWCERTIFICATEPROPERTIES_STRUCT struct are unused
  280. // cPropSheetPages
  281. // rgPropSheetPages
  282. BOOL
  283. WINAPI
  284. CryptUIGetCertificatePropertiesPagesW(
  285. IN PCCRYPTUI_VIEWCERTIFICATEPROPERTIES_STRUCTW pcsp,
  286. OUT BOOL *pfPropertiesChanged, // OPTIONAL
  287. OUT PROPSHEETPAGEW **prghPropPages,
  288. OUT DWORD *pcPropPages
  289. );
  290. BOOL
  291. WINAPI
  292. CryptUIGetCertificatePropertiesPagesA(
  293. IN PCCRYPTUI_VIEWCERTIFICATEPROPERTIES_STRUCTA pcsp,
  294. OUT BOOL *pfPropertiesChanged, // OPTIONAL
  295. OUT PROPSHEETPAGEA **prghPropPages,
  296. OUT DWORD *pcPropPages
  297. );
  298. BOOL
  299. WINAPI
  300. CryptUIFreeCertificatePropertiesPagesW(
  301. IN PROPSHEETPAGEW *rghPropPages,
  302. IN DWORD cPropPages
  303. );
  304. BOOL
  305. WINAPI
  306. CryptUIFreeCertificatePropertiesPagesA(
  307. IN PROPSHEETPAGEA *rghPropPages,
  308. IN DWORD cPropPages
  309. );
  310. #ifdef UNICODE
  311. #define CryptUIDlgViewCertificateProperties CryptUIDlgViewCertificatePropertiesW
  312. #define PCRYPTUI_VIEWCERTIFICATEPROPERTIES_STRUCT PCRYPTUI_VIEWCERTIFICATEPROPERTIES_STRUCTW
  313. #define CRYPTUI_VIEWCERTIFICATEPROPERTIES_STRUCT CRYPTUI_VIEWCERTIFICATEPROPERTIES_STRUCTW
  314. #define PCCRYPTUI_VIEWCERTIFICATEPROPERTIES_STRUCT PCCRYPTUI_VIEWCERTIFICATEPROPERTIES_STRUCTW
  315. #define CryptUIGetCertificatePropertiesPages CryptUIGetCertificatePropertiesPagesW
  316. #define CryptUIFreeCertificatePropertiesPages CryptUIFreeCertificatePropertiesPagesW
  317. #else
  318. #define CryptUIDlgViewCertificateProperties CryptUIDlgViewCertificatePropertiesA
  319. #define PCRYPTUI_VIEWCERTIFICATEPROPERTIES_STRUCT PCRYPTUI_VIEWCERTIFICATEPROPERTIES_STRUCTA
  320. #define CRYPTUI_VIEWCERTIFICATEPROPERTIES_STRUCT CRYPTUI_VIEWCERTIFICATEPROPERTIES_STRUCTA
  321. #define PCCRYPTUI_VIEWCERTIFICATEPROPERTIES_STRUCT PCCRYPTUI_VIEWCERTIFICATEPROPERTIES_STRUCTA
  322. #define CryptUIGetCertificatePropertiesPages CryptUIGetCertificatePropertiesPagesA
  323. #define CryptUIFreeCertificatePropertiesPages CryptUIFreeCertificatePropertiesPagesA
  324. #endif
  325. //
  326. // The certificate properties property sheet dialog is extensible via a callback mechanism.
  327. // A client needs to register their callback using CryptRegisterDefaultOIDFunction, and,
  328. // if they need to unregister it they should use CryptUnregisterDefaultOIDFunction.
  329. // The form for calling these functions is given below
  330. //
  331. // CryptRegisterDefaultOIDFunction(
  332. // 0,
  333. // CRYPTUILDLG_CERTPROP_PAGES_CALLBACK,
  334. // CRYPT_REGISTER_FIRST_INDEX,
  335. // L"c:\\fully qualified path\\dll_being_registered.dll"); <<----- your dll name
  336. //
  337. // CryptUnregisterDefaultOIDFunction(
  338. // 0,
  339. // CRYPTUILDLG_CERTPROP_PAGES_CALLBACK,
  340. // L"c:\\fully qualified path\\dll_being_registered.dll"); <<----- your dll name
  341. //
  342. // NOTE: Per the documentation on CryptRegisterDefaultOIDFunction in wincrypt.h,
  343. // the dll name may contain environment-variable strings
  344. // which are ExpandEnvironmentStrings()'ed before loading the Dll.
  345. //
  346. #define MAX_CLIENT_PAGES 20
  347. #define CRYPTUILDLG_CERTPROP_PAGES_CALLBACK "CryptUIDlgClientCertPropPagesCallback"
  348. //
  349. //
  350. // The typedef for the callback function which resides in the registered dll is given
  351. // below. Note that the callback must have the name #defined by
  352. // CRYPTUILDLG_CERTPROP_PAGES_CALLBACK
  353. //
  354. // pCertContext - The certificate for which the properties are being displayed.
  355. // rgPropPages - An array of PropSheetPageW structures that are to be filled in by
  356. // the client with the property pages to be shown.
  357. // pcPropPages - A pointer to a DWORD that on input contains the maximum number of
  358. // PropSheetPages the client may supply, and on output must have been
  359. // filled in by the client with the number of pages they supplied in
  360. // rgPropPages.
  361. //
  362. // Return Value: The client should return TRUE if they wish to show extra property pages,
  363. // in this case pcPropPages must >= 1 and rgPropPages must have the
  364. // corresponding number of pages. or, return FALSE if no pages are suplied.
  365. typedef BOOL (WINAPI *PFN_CRYPTUIDLG_CERTPROP_PAGES_CALLBACK)
  366. (IN PCCERT_CONTEXT pCertContext,
  367. OUT PROPSHEETPAGEW *rgPropPages,
  368. IN OUT DWORD *pcPropPages);
  369. /////////////////////////////////////////////////////////////////////////////////////////////////////
  370. /////////////////////////////////////////////////////////////////////////////////////////////////////
  371. //
  372. // dwSize size of this struct
  373. // hwndParent parent of this dialog (OPTIONAL)
  374. // dwFlags flags, may a combination of any of the flags below
  375. // szTitle title for the window (OPTIONAL)
  376. // pCTLContext the ctl context that is to be displayed
  377. // cCertSearchStores; count of other stores to search for the certs contained (OPTIONAL)
  378. // in the ctl
  379. // rghCertSearchStores; array of other stores to search for the certs contained (OPTIONAL)
  380. // in the ctl
  381. // cStores Count of other stores to search when building and (OPTIONAL)
  382. // validating chain of the cert which signed the ctl
  383. // and the certs contained in the ctl
  384. // rghStores Array of other stores to search when buliding and (OPTIONAL)
  385. // validating chain of the cert which signed the ctl
  386. // and the certs contained in the ctl
  387. // cPropSheetPages number of extra pages to add to the dialog (OPTIONAL)
  388. // rgPropSheetPages extra pages to add to the dialog (OPTIONAL)
  389. //
  390. /////////////////////////////////////////////////////////////////////////////////////////////////////
  391. // dwFlags
  392. #define CRYPTUI_HIDE_TRUSTLIST_PAGE 0x00000001
  393. typedef struct tagCRYPTUI_VIEWCTL_STRUCTW {
  394. DWORD dwSize;
  395. HWND hwndParent; // OPTIONAL
  396. DWORD dwFlags; // OPTIONAL
  397. LPCWSTR szTitle; // OPTIONAL
  398. PCCTL_CONTEXT pCTLContext;
  399. DWORD cCertSearchStores; // OPTIONAL
  400. HCERTSTORE * rghCertSearchStores;// OPTIONAL
  401. DWORD cStores; // OPTIONAL
  402. HCERTSTORE * rghStores; // OPTIONAL
  403. DWORD cPropSheetPages; // OPTIONAL
  404. LPCPROPSHEETPAGEW rgPropSheetPages; // OPTIONAL
  405. } CRYPTUI_VIEWCTL_STRUCTW, *PCRYPTUI_VIEWCTL_STRUCTW;
  406. typedef const CRYPTUI_VIEWCTL_STRUCTW *PCCRYPTUI_VIEWCTL_STRUCTW;
  407. typedef struct tagCRYPTUI_VIEWCTL_STRUCTA {
  408. DWORD dwSize;
  409. HWND hwndParent; // OPTIONAL
  410. DWORD dwFlags; // OPTIONAL
  411. LPCSTR szTitle; // OPTIONAL
  412. PCCTL_CONTEXT pCTLContext;
  413. DWORD cCertSearchStores; // OPTIONAL
  414. HCERTSTORE * rghCertSearchStores;// OPTIONAL
  415. DWORD cStores; // OPTIONAL
  416. HCERTSTORE * rghStores; // OPTIONAL
  417. DWORD cPropSheetPages; // OPTIONAL
  418. LPCPROPSHEETPAGEA rgPropSheetPages; // OPTIONAL
  419. } CRYPTUI_VIEWCTL_STRUCTA, *PCRYPTUI_VIEWCTL_STRUCTA;
  420. typedef const CRYPTUI_VIEWCTL_STRUCTA *PCCRYPTUI_VIEWCTL_STRUCTA;
  421. BOOL
  422. WINAPI
  423. CryptUIDlgViewCTLW(
  424. IN PCCRYPTUI_VIEWCTL_STRUCTW pcvctl
  425. );
  426. BOOL
  427. WINAPI
  428. CryptUIDlgViewCTLA(
  429. IN PCCRYPTUI_VIEWCTL_STRUCTA pcvctl
  430. );
  431. #ifdef UNICODE
  432. #define CryptUIDlgViewCTL CryptUIDlgViewCTLW
  433. #define PCRYPTUI_VIEWCTL_STRUCT PCRYPTUI_VIEWCTL_STRUCTW
  434. #define CRYPTUI_VIEWCTL_STRUCT CRYPTUI_VIEWCTL_STRUCTW
  435. #define PCCRYPTUI_VIEWCTL_STRUCT PCCRYPTUI_VIEWCTL_STRUCTW
  436. #else
  437. #define CryptUIDlgViewCTL CryptUIDlgViewCTLA
  438. #define PCRYPTUI_VIEWCTL_STRUCT PCRYPTUI_VIEWCTL_STRUCTA
  439. #define CRYPTUI_VIEWCTL_STRUCT CRYPTUI_VIEWCTL_STRUCTA
  440. #define PCCRYPTUI_VIEWCTL_STRUCT PCCRYPTUI_VIEWCTL_STRUCTA
  441. #endif
  442. /////////////////////////////////////////////////////////////////////////////////////////////////////
  443. /////////////////////////////////////////////////////////////////////////////////////////////////////
  444. //
  445. // dwSize size of this struct
  446. // hwndParent parent of this dialog (OPTIONAL)
  447. // dwFlags flags, may a combination of any of the flags below
  448. // szTitle title for the window (OPTIONAL)
  449. // pCTLContext the ctl context that is to be displayed
  450. // cStores count of other stores to search for the cert which (OPTIONAL)
  451. // signed the crl and to build and validate the
  452. // cert's chain
  453. // rghStores array of other stores to search for the cert which (OPTIONAL)
  454. // signed the crl and to build and validate the
  455. // cert's chain
  456. // cPropSheetPages number of extra pages to add to the dialog (OPTIONAL)
  457. // rgPropSheetPages extra pages to add to the dialog (OPTIONAL)
  458. //
  459. /////////////////////////////////////////////////////////////////////////////////////////////////////
  460. // dwFlags
  461. #define CRYPTUI_HIDE_REVOCATIONLIST_PAGE 0x00000001
  462. typedef struct tagCRYPTUI_VIEWCRL_STRUCTW {
  463. DWORD dwSize;
  464. HWND hwndParent; // OPTIONAL
  465. DWORD dwFlags; // OPTIONAL
  466. LPCWSTR szTitle; // OPTIONAL
  467. PCCRL_CONTEXT pCRLContext;
  468. DWORD cStores; // OPTIONAL
  469. HCERTSTORE * rghStores; // OPTIONAL
  470. DWORD cPropSheetPages; // OPTIONAL
  471. LPCPROPSHEETPAGEW rgPropSheetPages; // OPTIONAL
  472. } CRYPTUI_VIEWCRL_STRUCTW, *PCRYPTUI_VIEWCRL_STRUCTW;
  473. typedef const CRYPTUI_VIEWCRL_STRUCTW *PCCRYPTUI_VIEWCRL_STRUCTW;
  474. typedef struct tagCRYPTUI_VIEWCRL_STRUCTA {
  475. DWORD dwSize;
  476. HWND hwndParent; // OPTIONAL
  477. DWORD dwFlags; // OPTIONAL
  478. LPCSTR szTitle; // OPTIONAL
  479. PCCRL_CONTEXT pCRLContext;
  480. DWORD cStores; // OPTIONAL
  481. HCERTSTORE * rghStores; // OPTIONAL
  482. DWORD cPropSheetPages; // OPTIONAL
  483. LPCPROPSHEETPAGEA rgPropSheetPages; // OPTIONAL
  484. } CRYPTUI_VIEWCRL_STRUCTA, *PCRYPTUI_VIEWCRL_STRUCTA;
  485. typedef const CRYPTUI_VIEWCRL_STRUCTA *PCCRYPTUI_VIEWCRL_STRUCTA;
  486. BOOL
  487. WINAPI
  488. CryptUIDlgViewCRLW(
  489. IN PCCRYPTUI_VIEWCRL_STRUCTW pcvcrl
  490. );
  491. BOOL
  492. WINAPI
  493. CryptUIDlgViewCRLA(
  494. IN PCCRYPTUI_VIEWCRL_STRUCTA pcvcrl
  495. );
  496. #ifdef UNICODE
  497. #define CryptUIDlgViewCRL CryptUIDlgViewCRLW
  498. #define PCRYPTUI_VIEWCRL_STRUCT PCRYPTUI_VIEWCRL_STRUCTW
  499. #define CRYPTUI_VIEWCRL_STRUCT CRYPTUI_VIEWCRL_STRUCTW
  500. #define PCCRYPTUI_VIEWCRL_STRUCT PCCRYPTUI_VIEWCRL_STRUCTW
  501. #else
  502. #define CryptUIDlgViewCRL CryptUIDlgViewCRLA
  503. #define PCRYPTUI_VIEWCRL_STRUCT PCRYPTUI_VIEWCRL_STRUCTA
  504. #define CRYPTUI_VIEWCRL_STRUCT CRYPTUI_VIEWCRL_STRUCTA
  505. #define PCCRYPTUI_VIEWCRL_STRUCT PCCRYPTUI_VIEWCRL_STRUCTA
  506. #endif
  507. /////////////////////////////////////////////////////////////////////////////////////////////////////
  508. /////////////////////////////////////////////////////////////////////////////////////////////////////
  509. //
  510. // dwSize size of this struct
  511. // hwndParent parent of this dialog (OPTIONAL)
  512. // dwFlags flags, may a combination of any of the flags below
  513. // szTitle title for the window (OPTIONAL)
  514. // pSignerInfo the signer info struct that is to be displayed
  515. // hMsg the HCRYPTMSG that the signer info was extracted from
  516. // pszOID an OID that signifies what the certificate that did the (OPTIONAL)
  517. // signing whould be validated for. for instance if this is
  518. // being called to view the signature of a CTL the
  519. // szOID_KP_CTL_USAGE_SIGNING OID should be passed in.
  520. // if this is NULL then the certificate is only validated
  521. // cryptographicaly and not for usages.
  522. // dwReserved reserved for future use and must be set to NULL
  523. // cStores count of other stores to search for the cert which (OPTIONAL)
  524. // did the signing and to build and validate the
  525. // cert's chain
  526. // rghStores array of other stores to search for the cert which (OPTIONAL)
  527. // did the signing and to build and validate the
  528. // cert's chain
  529. // cPropSheetPages number of extra pages to add to the dialog (OPTIONAL)
  530. // rgPropSheetPages extra pages to add to the dialog (OPTIONAL)
  531. //
  532. /////////////////////////////////////////////////////////////////////////////////////////////////////
  533. // dwFlags
  534. #define CRYPTUI_HIDE_TRUSTLIST_PAGE 0x00000001
  535. typedef struct tagCRYPTUI_VIEWSIGNERINFO_STRUCTW {
  536. DWORD dwSize;
  537. HWND hwndParent; // OPTIONAL
  538. DWORD dwFlags; // OPTIONAL
  539. LPCWSTR szTitle; // OPTIONAL
  540. CMSG_SIGNER_INFO const *pSignerInfo;
  541. HCRYPTMSG hMsg;
  542. LPCSTR pszOID; // OPTIONAL
  543. DWORD_PTR dwReserved;
  544. DWORD cStores; // OPTIONAL
  545. HCERTSTORE *rghStores; // OPTIONAL
  546. DWORD cPropSheetPages; // OPTIONAL
  547. LPCPROPSHEETPAGEW rgPropSheetPages; // OPTIONAL
  548. } CRYPTUI_VIEWSIGNERINFO_STRUCTW, *PCRYPTUI_VIEWSIGNERINFO_STRUCTW;
  549. typedef const CRYPTUI_VIEWSIGNERINFO_STRUCTW *PCCRYPTUI_VIEWSIGNERINFO_STRUCTW;
  550. typedef struct tagCRYPTUI_VIEWSIGNERINFO_STRUCTA {
  551. DWORD dwSize;
  552. HWND hwndParent; // OPTIONAL
  553. DWORD dwFlags; // OPTIONAL
  554. LPCSTR szTitle; // OPTIONAL
  555. CMSG_SIGNER_INFO const *pSignerInfo;
  556. HCRYPTMSG hMsg;
  557. LPCSTR pszOID; // OPTIONAL
  558. DWORD_PTR dwReserved;
  559. DWORD cStores; // OPTIONAL
  560. HCERTSTORE *rghStores; // OPTIONAL
  561. DWORD cPropSheetPages; // OPTIONAL
  562. LPCPROPSHEETPAGEA rgPropSheetPages; // OPTIONAL
  563. } CRYPTUI_VIEWSIGNERINFO_STRUCTA, *PCRYPTUI_VIEWSIGNERINFO_STRUCTA;
  564. typedef const CRYPTUI_VIEWSIGNERINFO_STRUCTA *PCCRYPTUI_VIEWSIGNERINFO_STRUCTA;
  565. BOOL
  566. WINAPI
  567. CryptUIDlgViewSignerInfoW(
  568. IN PCCRYPTUI_VIEWSIGNERINFO_STRUCTW pcvsi
  569. );
  570. BOOL
  571. WINAPI
  572. CryptUIDlgViewSignerInfoA(
  573. IN PCCRYPTUI_VIEWSIGNERINFO_STRUCTA pcvsi
  574. );
  575. #ifdef UNICODE
  576. #define CryptUIDlgViewSignerInfo CryptUIDlgViewSignerInfoW
  577. #define PCRYPTUI_VIEWSIGNERINFO_STRUCT PCRYPTUI_VIEWSIGNERINFO_STRUCTW
  578. #define CRYPTUI_VIEWSIGNERINFO_STRUCT CRYPTUI_VIEWSIGNERINFO_STRUCTW
  579. #define PCCRYPTUI_VIEWSIGNERINFO_STRUCT PCCRYPTUI_VIEWSIGNERINFO_STRUCTW
  580. #else
  581. #define CryptUIDlgViewSignerInfo CryptUIDlgViewSignerInfoA
  582. #define PCRYPTUI_VIEWSIGNERINFO_STRUCT PCRYPTUI_VIEWSIGNERINFO_STRUCTA
  583. #define CRYPTUI_VIEWSIGNERINFO_STRUCT CRYPTUI_VIEWSIGNERINFO_STRUCTA
  584. #define PCCRYPTUI_VIEWSIGNERINFO_STRUCT PCCRYPTUI_VIEWSIGNERINFO_STRUCTA
  585. #endif
  586. /////////////////////////////////////////////////////////////////////////////////////////////////////
  587. /////////////////////////////////////////////////////////////////////////////////////////////////////
  588. //
  589. // dwSize size of this struct
  590. // hwndParent parent of this dialog (OPTIONAL)
  591. // dwFlags flags, must be set to 0
  592. // szTitle title for the window (OPTIONAL)
  593. // choice the form of the message that is to have its signers displayed
  594. // u either an encoded message or a message handle
  595. // EncodedMessage a data blob which contains a pointer to the encoded data
  596. // and the count of encoded bytes
  597. // hMsg a message handle
  598. // szFileName the fully qualified file name, should be passed in if (OPTIONAL)
  599. // signatures on a file are being viewed
  600. // pPropPageCallback this callback will be called when each page that is (OPTIONAL)
  601. // returned in the CryptUIGetViewSignaturesPages call
  602. // is about to be created or destroyed. if this is NULL no
  603. // callback is made.
  604. // pvCallbackData this is uniterpreted data that is passed back when the (OPTIONAL)
  605. // when pPropPageCallback is made
  606. // cStores count of other stores to search for the cert which (OPTIONAL)
  607. // did the signing and to build and validate the
  608. // cert's chain
  609. // rghStores array of other stores to search for the cert which (OPTIONAL)
  610. // did the signing and to build and validate the
  611. // cert's chain
  612. // cPropSheetPages number of extra pages to add to the dialog (OPTIONAL)
  613. // rgPropSheetPages extra pages to add to the dialog (OPTIONAL)
  614. //
  615. /////////////////////////////////////////////////////////////////////////////////////////////////////
  616. // for the coice field of the CRYPTUI_VIEWSIGNATURES_STRUCT structure
  617. #define EncodedMessage_Chosen 1
  618. #define hMsg_Chosen 2
  619. typedef struct tagCRYPTUI_VIEWSIGNATURES_STRUCTW {
  620. DWORD dwSize;
  621. HWND hwndParent; // OPTIONAL
  622. DWORD dwFlags; // OPTIONAL
  623. LPCWSTR szTitle; // OPTIONAL
  624. unsigned short choice;
  625. union {
  626. CRYPT_DATA_BLOB EncodedMessage;
  627. HCRYPTMSG hMsg;
  628. } u;
  629. LPCWSTR szFileName; // OPTIONAL
  630. PFNCPROPPAGECALLBACK pPropPageCallback; // OPTIONAL
  631. void * pvCallbackData; // OPTIONAL
  632. DWORD cStores; // OPTIONAL
  633. HCERTSTORE * rghStores; // OPTIONAL
  634. DWORD cPropSheetPages; // OPTIONAL
  635. LPCPROPSHEETPAGEW rgPropSheetPages; // OPTIONAL
  636. } CRYPTUI_VIEWSIGNATURES_STRUCTW, *PCRYPTUI_VIEWSIGNATURES_STRUCTW;
  637. typedef const CRYPTUI_VIEWSIGNATURES_STRUCTW *PCCRYPTUI_VIEWSIGNATURES_STRUCTW;
  638. typedef struct tagCRYPTUI_VIEWSIGNATURES_STRUCTA {
  639. DWORD dwSize;
  640. HWND hwndParent; // OPTIONAL
  641. DWORD dwFlags; // OPTIONAL
  642. LPCSTR szTitle; // OPTIONAL
  643. unsigned short choice;
  644. union {
  645. CRYPT_DATA_BLOB EncodedMessage;
  646. HCRYPTMSG hMsg;
  647. } u;
  648. LPCSTR szFileName; // OPTIONAL
  649. PFNCPROPPAGECALLBACK pPropPageCallback; // OPTIONAL
  650. void * pvCallbackData; // OPTIONAL
  651. DWORD cStores; // OPTIONAL
  652. HCERTSTORE * rghStores; // OPTIONAL
  653. DWORD cPropSheetPages; // OPTIONAL
  654. LPCPROPSHEETPAGEA rgPropSheetPages; // OPTIONAL
  655. } CRYPTUI_VIEWSIGNATURES_STRUCTA, *PCRYPTUI_VIEWSIGNATURES_STRUCTA;
  656. typedef const CRYPTUI_VIEWSIGNATURES_STRUCTA *PCCRYPTUI_VIEWSIGNATURES_STRUCTA;
  657. // NOTE!! when calling this function, the following parameters of the
  658. // CRYPTUI_VIEWSIGNATURES_STRUCT struct are unused
  659. // cPropSheetPages
  660. // rgPropSheetPages
  661. // szTitle
  662. BOOL
  663. WINAPI
  664. CryptUIGetViewSignaturesPagesW(
  665. IN PCCRYPTUI_VIEWSIGNATURES_STRUCTW pcvs,
  666. OUT PROPSHEETPAGEW **prghPropPages,
  667. OUT DWORD *pcPropPages
  668. );
  669. BOOL
  670. WINAPI
  671. CryptUIGetViewSignaturesPagesA(
  672. IN PCCRYPTUI_VIEWSIGNATURES_STRUCTA pcvs,
  673. OUT PROPSHEETPAGEA **prghPropPages,
  674. OUT DWORD *pcPropPages
  675. );
  676. BOOL
  677. WINAPI
  678. CryptUIFreeViewSignaturesPagesW(
  679. IN PROPSHEETPAGEW *rghPropPages,
  680. IN DWORD cPropPages
  681. );
  682. BOOL
  683. WINAPI
  684. CryptUIFreeViewSignaturesPagesA(
  685. IN PROPSHEETPAGEA *rghPropPages,
  686. IN DWORD cPropPages
  687. );
  688. #ifdef UNICODE
  689. #define CryptUIGetViewSignaturesPages CryptUIGetViewSignaturesPagesW
  690. #define CryptUIFreeViewSignaturesPages CryptUIFreeViewSignaturesPagesW
  691. #define PCRYPTUI_VIEWSIGNATURES_STRUCT PCRYPTUI_VIEWSIGNATURES_STRUCTW
  692. #define CRYPTUI_VIEWSIGNATURES_STRUCT CRYPTUI_VIEWSIGNATURES_STRUCTW
  693. #define PCCRYPTUI_VIEWSIGNATURES_STRUCT PCCRYPTUI_VIEWSIGNATURES_STRUCTW
  694. #else
  695. #define CryptUIGetViewSignaturesPages CryptUIGetViewSignaturesPagesA
  696. #define CryptUIFreeViewSignaturesPages CryptUIFreeViewSignaturesPagesA
  697. #define PCRYPTUI_VIEWSIGNATURES_STRUCT PCRYPTUI_VIEWSIGNATURES_STRUCTA
  698. #define CRYPTUI_VIEWSIGNATURES_STRUCT CRYPTUI_VIEWSIGNATURES_STRUCTA
  699. #define PCCRYPTUI_VIEWSIGNATURES_STRUCT PCCRYPTUI_VIEWSIGNATURES_STRUCTA
  700. #endif
  701. /////////////////////////////////////////////////////////////////////////////////////////////////////
  702. //
  703. // the select store dialog can be passed a callback which is called to validate the store that the
  704. // user selected. Return TRUE to accept the store, or FALSE to reject the store. It TRUE is
  705. // returned then the store will be returned to the caller of CryptUIDlg\, if FALSE is returned
  706. // then the select store dialog will remain displayed so the user may make another selection
  707. typedef BOOL (WINAPI * PFNCVALIDATESTOREPROC)(
  708. HCERTSTORE hStore,
  709. HWND hWndSelectStoreDialog,
  710. void *pvCallbackData);
  711. /////////////////////////////////////////////////////////////////////////////////////////////////////
  712. // these two parameters are passed to the CertEnumSystemStore call and the stores that are
  713. // enumerated via that call are added to the store selection list.
  714. //
  715. // dwFlags CertEnumSystemStore
  716. // pvSystemStoreLocationPara CertEnumSystemStore
  717. typedef struct _STORENUMERATION_STRUCT {
  718. DWORD dwFlags;
  719. void * pvSystemStoreLocationPara;
  720. } STORENUMERATION_STRUCT, *PSTORENUMERATION_STRUCT;
  721. typedef const STORENUMERATION_STRUCT *PCSTORENUMERATION_STRUCT;
  722. /////////////////////////////////////////////////////////////////////////////////////////////////////
  723. // both the array of store handles and the array of enumeration strucs may be used to
  724. // populate the store selection list. if either is not used the count must be set to 0.
  725. // if the array of store handles is used the cert stores must have either been opened
  726. // with the CERT_STORE_SET_LOCALIZED_NAME_FLAG flag, or the CertSetStoreProperty function
  727. // must have been called with the CERT_STORE_LOCALIZED_NAME_PROP_ID flag. if the
  728. // CryptUIDlgSelectStore function is unable to obtain a name for a store that store will not
  729. // be displayed.
  730. //
  731. // cStores count of stores to select from
  732. // rghStores array of stores to select from
  733. // cEnumerationStructs count of enumeration structs
  734. // rgEnumerationStructs array of enumeration structs
  735. typedef struct _STORESFORSELCTION_STRUCT {
  736. DWORD cStores;
  737. HCERTSTORE * rghStores;
  738. DWORD cEnumerationStructs;
  739. PCSTORENUMERATION_STRUCT rgEnumerationStructs;
  740. } STORESFORSELCTION_STRUCT, *PSTORESFORSELCTION_STRUCT;
  741. typedef const STORESFORSELCTION_STRUCT *PCSTORESFORSELCTION_STRUCT;
  742. /////////////////////////////////////////////////////////////////////////////////////////////////////
  743. //
  744. // dwSize size of this struct
  745. // hwndParent parent of this dialog (OPTIONAL)
  746. // dwFlags flags, may a combination of any of the flags below
  747. // szTitle title of the dialog (OPTIONAL)
  748. // szDisplayString a string that will be displayed in the dialog that may (OPTIONAL)
  749. // be used to infor the user what they are selecting a store
  750. // for. if it is not set a default string will be displayed,
  751. // the default resource is IDS_SELECT_STORE_DEFAULT
  752. // pStoresForSelection a struct that contains the stores that are to be selected
  753. // from. the stores can be in two different formats, an array
  754. // of store handles and/or an array of enumeration structs
  755. // which will be used to call CertEnumSystemStore
  756. // pValidateStoreCallback a pointer to a PFNCVALIDATESTOREPROC which is used to (OPTIONAL)
  757. // callback the caller of CryptUIDlgSelectStore when the
  758. // user hasselected a store and pressed OK
  759. // pvCallbackData if pValidateStoreCallback is being used this value is (OPTIONAL)
  760. // passed back to the caller when the pValidateStoreCallback
  761. // is made
  762. //
  763. /////////////////////////////////////////////////////////////////////////////////////////////////////
  764. // dwFlags
  765. #define CRYPTUI_ALLOW_PHYSICAL_STORE_VIEW 0x00000001
  766. #define CRYPTUI_RETURN_READ_ONLY_STORE 0x00000002
  767. #define CRYPTUI_DISPLAY_WRITE_ONLY_STORES 0x00000004
  768. #define CRYPTUI_VALIDATE_STORES_AS_WRITABLE 0x00000008
  769. typedef struct tagCRYPTUI_SELECTSTORE_STRUCTW {
  770. DWORD dwSize;
  771. HWND hwndParent; // OPTIONAL
  772. DWORD dwFlags; // OPTIONAL
  773. LPCWSTR szTitle; // OPTIONAL
  774. LPCWSTR szDisplayString; // OPTIONAL
  775. PCSTORESFORSELCTION_STRUCT pStoresForSelection;
  776. PFNCVALIDATESTOREPROC pValidateStoreCallback; // OPTIONAL
  777. void * pvCallbackData; // OPTIONAL
  778. } CRYPTUI_SELECTSTORE_STRUCTW, *PCRYPTUI_SELECTSTORE_STRUCTW;
  779. typedef const CRYPTUI_SELECTSTORE_STRUCTW *PCCRYPTUI_SELECTSTORE_STRUCTW;
  780. typedef struct tagCRYPTUI_SELECTSTORE_STRUCTA {
  781. DWORD dwSize;
  782. HWND hwndParent; // OPTIONAL
  783. DWORD dwFlags; // OPTIONAL
  784. LPCSTR szTitle; // OPTIONAL
  785. LPCSTR szDisplayString; // OPTIONAL
  786. PCSTORESFORSELCTION_STRUCT pStoresForSelection;
  787. PFNCVALIDATESTOREPROC pValidateStoreCallback; // OPTIONAL
  788. void * pvCallbackData; // OPTIONAL
  789. } CRYPTUI_SELECTSTORE_STRUCTA, *PCRYPTUI_SELECTSTORE_STRUCTA;
  790. typedef const CRYPTUI_SELECTSTORE_STRUCTA *PCCRYPTUI_SELECTSTORE_STRUCTA;
  791. //
  792. // the HCERTSTORE that is returned must be closed by calling CertCloseStore
  793. //
  794. HCERTSTORE
  795. WINAPI
  796. CryptUIDlgSelectStoreW(
  797. IN PCCRYPTUI_SELECTSTORE_STRUCTW pcss
  798. );
  799. HCERTSTORE
  800. WINAPI
  801. CryptUIDlgSelectStoreA(
  802. IN PCCRYPTUI_SELECTSTORE_STRUCTA pcss
  803. );
  804. #ifdef UNICODE
  805. #define CryptUIDlgSelectStore CryptUIDlgSelectStoreW
  806. #define PCRYPTUI_SELECTSTORE_STRUCT PCRYPTUI_SELECTSTORE_STRUCTW
  807. #define CRYPTUI_SELECTSTORE_STRUCT CRYPTUI_SELECTSTORE_STRUCTW
  808. #define PCCRYPTUI_SELECTSTORE_STRUCT PCCRYPTUI_SELECTSTORE_STRUCTW
  809. #else
  810. #define CryptUIDlgSelectStore CryptUIDlgSelectStoreA
  811. #define PCRYPTUI_SELECTSTORE_STRUCT PCRYPTUI_SELECTSTORE_STRUCTA
  812. #define CRYPTUI_SELECTSTORE_STRUCT CRYPTUI_SELECTSTORE_STRUCTA
  813. #define PCCRYPTUI_SELECTSTORE_STRUCT PCCRYPTUI_SELECTSTORE_STRUCTA
  814. #endif
  815. /////////////////////////////////////////////////////////////////////////////////////////////////////
  816. /////////////////////////////////////////////////////////////////////////////////////////////////////
  817. //
  818. // The select cert dialog can be passed a filter proc to reduce the set of certificates
  819. // displayed. Return TRUE to display the certificate and FALSE to hide it. If TRUE is
  820. // returned then optionally the pfInitialSelectedCert boolean may be set to TRUE to indicate
  821. // to the dialog that this cert should be the initially selected cert. Note that the
  822. // most recent cert that had the pfInitialSelectedCert boolean set during the callback will
  823. // be the initially selected cert.
  824. typedef BOOL (WINAPI * PFNCFILTERPROC)(
  825. PCCERT_CONTEXT pCertContext,
  826. BOOL *pfInitialSelectedCert,
  827. void *pvCallbackData);
  828. /////////////////////////////////////////////////////////////////////////////////////////////////////
  829. //
  830. // Certificates may be viewed by the user when selecting certificates from the select certificate
  831. // dialog. This callback will allow the caller of the select certificate dialog to handle the
  832. // displaying of those certificates. This may be useful if the caller wishes to call WinVerifyTrust
  833. // with their own policy module and display the certificate with that WinVerifyTrust state. If
  834. // FALSE is returned from this callback it is assumed that the select certificate dialog will be
  835. // responsible for dislaying the certificate in question. If TRUE is returned it is assumed that the
  836. // display of the certificate was already handled.
  837. typedef BOOL (WINAPI * PFNCCERTDISPLAYPROC)(
  838. PCCERT_CONTEXT pCertContext,
  839. HWND hWndSelCertDlg,
  840. void *pvCallbackData);
  841. /////////////////////////////////////////////////////////////////////////////////////////////////////
  842. //
  843. // dwSize size of this struct
  844. // hwndParent parent of this dialog (OPTIONAL)
  845. // dwFlags flags, must be set to 0
  846. // dwDontUseColumn This can be used to disable the display of certain (OPTIONAL)
  847. // columns. It can be set with any comibnation of the
  848. // column flags below
  849. // szTitle title of the dialog (OPTIONAL)
  850. // szDisplayString a string that will be displayed in the dialog that may (OPTIONAL)
  851. // be used to inform the user what they are selecting a
  852. // a certificate for. if it is not set a default string
  853. // will be displayed. the defualt strings resourece is
  854. // IDS_SELECT_CERT_DEFAULT
  855. // pFilterCallback a pointer to a PFNCMFILTERPROC which is used to filter (OPTIONAL)
  856. // the certificates which are displayed for selection
  857. // pDisplayCallback a pointer to a PFNCCERTDISPLAYPROC which is used to
  858. // handle displaying certificates
  859. // pvCallbackData if either or both pFilterCallback or pDisplayCallback (OPTIONAL)
  860. // are being used this value is passed back to the caller
  861. // when the callbacks are made
  862. // cDisplayStores count of stores that contain the certs to display
  863. // for selection
  864. // rghDisplayStores array of stores that contain the certs to display
  865. // for selection
  866. // cStores count of other stores to search when building chain and (OPTIONAL)
  867. // validating trust of the certs which are displayed, if
  868. // the user choosing a cert would like to view a particular
  869. // cert which is displayed for selection, these stores
  870. // are passed to the CertViewCert dialog
  871. // rghStores array of other stores to search when building chain and (OPTIONAL)
  872. // validating trust of the certs which are displayed, if
  873. // the user choosing a cert would like to view a particular
  874. // cert which is displayed for selection, these stores
  875. // are passed to the CertViewCert dialog
  876. // cPropSheetPages PASS THROUGH - number of pages in rgPropSheetPages array (OPTIONAL)
  877. // rgPropSheetPages PASS THROUGH - extra pages that are passed through (OPTIONAL)
  878. // to the certificate viewing dialog when it is invoked from
  879. // the selection dialog
  880. //
  881. /////////////////////////////////////////////////////////////////////////////////////////////////////
  882. // flags for dwDontUseColumn
  883. #define CRYPTUI_SELECT_ISSUEDTO_COLUMN 0x000000001
  884. #define CRYPTUI_SELECT_ISSUEDBY_COLUMN 0x000000002
  885. #define CRYPTUI_SELECT_INTENDEDUSE_COLUMN 0x000000004
  886. #define CRYPTUI_SELECT_FRIENDLYNAME_COLUMN 0x000000008
  887. #define CRYPTUI_SELECT_LOCATION_COLUMN 0x000000010
  888. #define CRYPTUI_SELECT_EXPIRATION_COLUMN 0x000000020
  889. typedef struct tagCRYPTUI_SELECTCERTIFICATE_STRUCTW {
  890. DWORD dwSize;
  891. HWND hwndParent; // OPTIONAL
  892. DWORD dwFlags; // OPTIONAL
  893. LPCWSTR szTitle; // OPTIONAL
  894. DWORD dwDontUseColumn; // OPTIONAL
  895. LPCWSTR szDisplayString; // OPTIONAL
  896. PFNCFILTERPROC pFilterCallback; // OPTIONAL
  897. PFNCCERTDISPLAYPROC pDisplayCallback; // OPTIONAL
  898. void * pvCallbackData; // OPTIONAL
  899. DWORD cDisplayStores;
  900. HCERTSTORE * rghDisplayStores;
  901. DWORD cStores; // OPTIONAL
  902. HCERTSTORE * rghStores; // OPTIONAL
  903. DWORD cPropSheetPages; // OPTIONAL
  904. LPCPROPSHEETPAGEW rgPropSheetPages; // OPTIONAL
  905. } CRYPTUI_SELECTCERTIFICATE_STRUCTW, *PCRYPTUI_SELECTCERTIFICATE_STRUCTW;
  906. typedef const CRYPTUI_SELECTCERTIFICATE_STRUCTW *PCCRYPTUI_SELECTCERTIFICATE_STRUCTW;
  907. typedef struct tagCRYPTUI_SELECTCERTIFICATE_STRUCT_A {
  908. DWORD dwSize;
  909. HWND hwndParent; // OPTIONAL
  910. DWORD dwFlags; // OPTIONAL
  911. LPCSTR szTitle; // OPTIONAL
  912. DWORD dwDontUseColumn; // OPTIONAL
  913. LPCSTR szDisplayString; // OPTIONAL
  914. PFNCFILTERPROC pFilterCallback; // OPTIONAL
  915. PFNCCERTDISPLAYPROC pDisplayCallback; // OPTIONAL
  916. void * pvCallbackData; // OPTIONAL
  917. DWORD cDisplayStores;
  918. HCERTSTORE * rghDisplayStores;
  919. DWORD cStores; // OPTIONAL
  920. HCERTSTORE * rghStores; // OPTIONAL
  921. DWORD cPropSheetPages; // OPTIONAL
  922. LPCPROPSHEETPAGEA rgPropSheetPages; // OPTIONAL
  923. } CRYPTUI_SELECTCERTIFICATE_STRUCTA, *PCRYPTUI_SELECTCERTIFICATE_STRUCTA;
  924. typedef const CRYPTUI_SELECTCERTIFICATE_STRUCTA *PCCRYPTUI_SELECTCERTIFICATE_STRUCTA;
  925. //
  926. // the PCCERT_CONTEXT that is returned must be released by calling CertFreeCertificateContext().
  927. // if NULL is returned and GetLastError() == 0 then the user dismissed the dialog by hitting the
  928. // "cancel" button, otherwise GetLastError() will contain the last error.
  929. //
  930. PCCERT_CONTEXT
  931. WINAPI
  932. CryptUIDlgSelectCertificateW(
  933. IN PCCRYPTUI_SELECTCERTIFICATE_STRUCTW pcsc
  934. );
  935. PCCERT_CONTEXT
  936. WINAPI
  937. CryptUIDlgSelectCertificateA(
  938. IN PCCRYPTUI_SELECTCERTIFICATE_STRUCTA pcsc
  939. );
  940. #ifdef UNICODE
  941. #define CryptUIDlgSelectCertificate CryptUIDlgSelectCertificateW
  942. #define PCRYPTUI_SELECTCERTIFICATE_STRUCT PCRYPTUI_SELECTCERTIFICATE_STRUCTW
  943. #define CRYPTUI_SELECTCERTIFICATE_STRUCT CRYPTUI_SELECTCERTIFICATE_STRUCTW
  944. #define PCCRYPTUI_SELECTCERTIFICATE_STRUCT PCCRYPTUI_SELECTCERTIFICATE_STRUCTW
  945. #else
  946. #define CryptUIDlgSelectCertificate CryptUIDlgSelectCertificateA
  947. #define PCRYPTUI_SELECTCERTIFICATE_STRUCT PCRYPTUI_SELECTCERTIFICATE_STRUCTA
  948. #define CRYPTUI_SELECTCERTIFICATE_STRUCT CRYPTUI_SELECTCERTIFICATE_STRUCTA
  949. #define PCCRYPTUI_SELECTCERTIFICATE_STRUCT PCCRYPTUI_SELECTCERTIFICATE_STRUCTA
  950. #endif
  951. //flags for dwFlags in CRYPTUI_SELECT_CA_STRUCT struct
  952. #define CRYPTUI_DLG_SELECT_CA_FROM_NETWORK 0x0001
  953. #define CRYPTUI_DLG_SELECT_CA_USE_DN 0x0002
  954. #define CRYPTUI_DLG_SELECT_CA_LOCAL_MACHINE_ENUMERATION 0x0004
  955. //-------------------------------------------------------------------------
  956. //
  957. // CRYPTUI_CA_CONTEXT
  958. //
  959. //-------------------------------------------------------------------------
  960. typedef struct _CRYPTUI_CA_CONTEXT
  961. {
  962. DWORD dwSize;
  963. LPCWSTR pwszCAName;
  964. LPCWSTR pwszCAMachineName;
  965. }CRYPTUI_CA_CONTEXT, *PCRYPTUI_CA_CONTEXT;
  966. typedef const CRYPTUI_CA_CONTEXT *PCCRYPTUI_CA_CONTEXT;
  967. //-------------------------------------------------------------------------
  968. //
  969. //
  970. //
  971. // The select certificate authoritiy (CA) dialog can be passed a filter proc to reduce the set of CAs
  972. // displayed. Return TRUE to display the CA and FALSE to hide it. If TRUE is
  973. // returned then optionally the pfInitialSelectedCert boolean may be set to TRUE to indicate
  974. // to the dialog that this CA should be the initially selected CA. Note that the
  975. // most recent cert that had the pfInitialSelectedCert boolean set during the callback will
  976. // be the initially selected CA.
  977. //
  978. //-------------------------------------------------------------------------
  979. typedef BOOL (WINAPI * PFN_CRYPTUI_SELECT_CA_FUNC)(
  980. PCCRYPTUI_CA_CONTEXT pCAContext,
  981. BOOL *pfInitialSelected,
  982. void *pvCallbackData);
  983. //-------------------------------------------------------------------------
  984. //
  985. // CRYPTUI_SELECT_CA_STRUCT
  986. //
  987. // dwSize Required: Must be set to sizeof(CRYPTUI_SELECT_CA_STRUCT)
  988. // hwndParent Optional: Parent of this dialog
  989. // dwFlags Optional: Flags, Can be set to any combination of the following:
  990. // CRYPTUI_DLG_SELECT_CA_FROM_NETWORK:
  991. // All the available CAs from the network will be displayed
  992. // CRYPTUI_DLG_SELECT_CA_USE_DN:
  993. // Use the full DN (Distinguished Name) as the CA name.
  994. // By default, CN (common name) is used.
  995. // CRYPTUI_DLG_SELECT_CA_LOCAL_MACHINE_ENUMERATION:
  996. // Display the CAs available to the local machine only.
  997. // By Default, CAs available to the current user will be displayed
  998. // wszTitle Optional: Title of the dialog
  999. // wszDisplayString Optional: A string that will be displayed in the dialog that may (OPTIONAL)
  1000. // be used to inform the user what they are selecting a
  1001. // a certificate for. if it is not set a default string
  1002. // will be displayed. the defualt strings resourece is
  1003. // IDS_SELECT_CA_DISPLAY_DEFAULT
  1004. // cCAContext Optional: The count of additional CA contexts that will be displayed
  1005. // in the dialogs
  1006. // *rgCAContext Optioanl: The array of additional CA contexts that will be displayed
  1007. // in the dialogs
  1008. // pSelectCACallback Optional: a pointer to a PCCRYPTUI_CA_CONTEXT which is used to filter
  1009. // the certificate autorities which are displayed for selection
  1010. // pvCallbackData Optional: if pSelectCACallback is being used this value is passed
  1011. // back to the caller when the pSelectCACallback is made
  1012. //-------------------------------------------------------------------------
  1013. typedef struct _CRYPTUI_SELECT_CA_STRUCT
  1014. {
  1015. DWORD dwSize; // REQUIRED
  1016. HWND hwndParent; // OPTIONAL
  1017. DWORD dwFlags; // OPTIONAL
  1018. LPCWSTR wszTitle; // OPTIONAL
  1019. LPCWSTR wszDisplayString; // OPTIONAL
  1020. DWORD cCAContext; // OPTIONAL
  1021. PCCRYPTUI_CA_CONTEXT *rgCAContext; // OPTIONAL
  1022. PFN_CRYPTUI_SELECT_CA_FUNC pSelectCACallback; // OPTIONAL
  1023. void *pvCallbackData; // OPTIONAL
  1024. }CRYPTUI_SELECT_CA_STRUCT, *PCRYPTUI_SELECT_CA_STRUCT;
  1025. typedef const CRYPTUI_SELECT_CA_STRUCT *PCCRYPTUI_SELECT_CA_STRUCT;
  1026. //--------------------------------------------------------------
  1027. //
  1028. // Parameters:
  1029. // pCryptUISelectCA IN Required
  1030. //
  1031. // the PCCRYPTUI_CA_CONTEXT that is returned must be released by calling
  1032. // CryptUIDlgFreeCAContext
  1033. // if NULL is returned and GetLastError() == 0 then the user dismissed the dialog by hitting the
  1034. // "cancel" button, otherwise GetLastError() will contain the last error.
  1035. //
  1036. //
  1037. //--------------------------------------------------------------
  1038. PCCRYPTUI_CA_CONTEXT
  1039. WINAPI
  1040. CryptUIDlgSelectCA(
  1041. IN PCCRYPTUI_SELECT_CA_STRUCT pCryptUISelectCA
  1042. );
  1043. BOOL
  1044. WINAPI
  1045. CryptUIDlgFreeCAContext(
  1046. IN PCCRYPTUI_CA_CONTEXT pCAContext
  1047. );
  1048. //-------------------------------------------------------------------------
  1049. //
  1050. // CRYPTUI_CERT_MGR_STRUCT
  1051. //
  1052. // dwSize Required: Must be set to sizeof(CRYPTUI_CERT_MGR_STRUCT)
  1053. // hwndParent Optional: Parent of this dialog
  1054. // dwFlags Reserved: Must be set to 0
  1055. // wszTitle Optional: Title of the dialog
  1056. // pszInitUsageOID Optional: The enhanced key usage object identifier (OID).
  1057. // Certificates with this OID will initially
  1058. // be shown as a default. User
  1059. // can then choose different OIDs.
  1060. // NULL means all certificates will be shown initially.
  1061. //-------------------------------------------------------------------------
  1062. typedef struct _CRYPTUI_CERT_MGR_STRUCT
  1063. {
  1064. DWORD dwSize; // REQUIRED
  1065. HWND hwndParent; // OPTIONAL
  1066. DWORD dwFlags; // OPTIONAL
  1067. LPCWSTR pwszTitle; // OPTIONAL
  1068. LPCSTR pszInitUsageOID; // OPTIONAL
  1069. }CRYPTUI_CERT_MGR_STRUCT, *PCRYPTUI_CERT_MGR_STRUCT;
  1070. typedef const CRYPTUI_CERT_MGR_STRUCT *PCCRYPTUI_CERT_MGR_STRUCT;
  1071. //--------------------------------------------------------------
  1072. //
  1073. // Parameters:
  1074. // pCryptUICertMgr IN Required
  1075. //
  1076. //
  1077. //--------------------------------------------------------------
  1078. BOOL
  1079. WINAPI
  1080. CryptUIDlgCertMgr(
  1081. IN PCCRYPTUI_CERT_MGR_STRUCT pCryptUICertMgr);
  1082. /////////////////////////////////////////////////////////////////////////////////////////////////////
  1083. /////////////////////////////////////////////////////////////////////////////////////////////////////
  1084. //-----------------------------------------------------------------------
  1085. // The valid values for dwFlags for the CryptUIWiz APIs
  1086. //
  1087. //------------------------------------------------------------------------
  1088. #define CRYPTUI_WIZ_NO_UI 0x0001
  1089. //CRYPTUI_WIZ_NO_INSTALL_ROOT is only valid for CryptUIWizCertRequest API
  1090. //the wizard will not install the issued certificate chain into the root store,
  1091. //instead, it will put the certificate chain into the CA store.
  1092. #define CRYPTUI_WIZ_NO_INSTALL_ROOT 0x0010
  1093. //CRYPTUI_WIZ_BUILDCTL_SKIP_DESTINATION only valid for CryptUIWizBuildCTL API.
  1094. //the wizard will skip the page which asks user to enter destination where the CTL will
  1095. //be stored.
  1096. #define CRYPTUI_WIZ_BUILDCTL_SKIP_DESTINATION 0x0004
  1097. //CRYPTUI_WIZ_BUILDCTL_SKIP_SIGNING only valid for CryptUIWizBuildCTL API.
  1098. //the wizard will skip the page which asks user to sign the CTL.
  1099. //the CTLContext returned by CryptUIWizBuildCTL will not be signed.
  1100. //Caller can then use CryptUIWizDigitalSign to sign the CTL.
  1101. #define CRYPTUI_WIZ_BUILDCTL_SKIP_SIGNING 0x0008
  1102. //CRYPTUI_WIZ_BUILDCTL_SKIP_PURPOSE only valid for CryptUIWizBuildCTL API.
  1103. //the wizard will skip the page which asks user for the purpose, validity,
  1104. //and list ID of the CTL.
  1105. #define CRYPTUI_WIZ_BUILDCTL_SKIP_PURPOSE 0x0010
  1106. ///-----------------------------------------------------------------------
  1107. // CRYPTUI_WIZ_CERT_REQUEST_PVK_CERT
  1108. //
  1109. //------------------------------------------------------------------------
  1110. typedef struct _CRYPTUI_WIZ_CERT_REQUEST_PVK_CERT
  1111. {
  1112. DWORD dwSize; //Required: Set to the sizeof(CRYPTUI_WIZ_CERT_REQUEST_PVK_CERT)
  1113. PCCERT_CONTEXT pCertContext; //Required: Use the private key of the certificate context
  1114. // The certificate context
  1115. // has to have CERT_KEY_PROV_INFO_PROP_ID property
  1116. // and the private key has to exist
  1117. }CRYPTUI_WIZ_CERT_REQUEST_PVK_CERT, *PCRYPTUI_WIZ_CERT_REQUEST_PVK_CERT;
  1118. typedef const CRYPTUI_WIZ_CERT_REQUEST_PVK_CERT *PCCRYPTUI_WIZ_CERT_REQUEST_PVK_CERT;
  1119. ///-----------------------------------------------------------------------
  1120. // CRYPTUI_WIZ_CERT_REQUEST_PVK_EXISTING
  1121. //
  1122. //------------------------------------------------------------------------
  1123. typedef struct _CRYPTUI_WIZ_CERT_REQUEST_PVK_EXISTING
  1124. {
  1125. DWORD dwSize; //Required: Set to the sizeof(CRYPTUI_WIZ_CERT_REQUEST_PVK_EXISTING)
  1126. PCRYPT_KEY_PROV_INFO pKeyProvInfo; //Required: The information about the provider and the private key
  1127. // The optional CRYPT_KEY_PROV_PARAM fields in PCRYPT_KEY_PROV_INFO
  1128. // are ignored.
  1129. }CRYPTUI_WIZ_CERT_REQUEST_PVK_EXISTING, *PCRYPTUI_WIZ_CERT_REQUEST_PVK_EXISTING;
  1130. typedef const CRYPTUI_WIZ_CERT_REQUEST_PVK_EXISTING *PCCRYPTUI_WIZ_CERT_REQUEST_PVK_EXISTING;
  1131. ///-----------------------------------------------------------------------
  1132. // CERT_REQUEST_PVK_NEW
  1133. //
  1134. //------------------------------------------------------------------------
  1135. typedef struct _CRYPTUI_WIZ_CERT_REQUEST_PVK_NEW
  1136. {
  1137. DWORD dwSize; //Required: Set to the sizeof(CRYPTUI_WIZ_CERT_REQUEST_PVK_NEW)
  1138. PCRYPT_KEY_PROV_INFO pKeyProvInfo; //Optional: The information about the provider and the private key
  1139. // NULL means use the default
  1140. // The optional CRYPT_KEY_PROV_PARAM fields in PCRYPT_KEY_PROV_INFO
  1141. // are ignored.
  1142. DWORD dwGenKeyFlags; //Optional: The flags for CryptGenKey
  1143. }CRYPTUI_WIZ_CERT_REQUEST_PVK_NEW, *PCRYPTUI_WIZ_CERT_REQUEST_PVK_NEW;
  1144. typedef const CRYPTUI_WIZ_CERT_REQUEST_PVK_NEW *PCCRYPTUI_WIZ_CERT_REQUEST_PVK_NEW;
  1145. ///-----------------------------------------------------------------------
  1146. // CRYPTUI_WIZ_CERT_TYPE
  1147. //
  1148. //------------------------------------------------------------------------
  1149. typedef struct _CRYPTUI_WIZ_CERT_TYPE
  1150. {
  1151. DWORD dwSize; //Required: Set to the sizeof(CRYPTUI_WIZ_CERT_TYPE)
  1152. DWORD cCertType; //the count of rgwszCertType. cCertType should be 1.
  1153. LPWSTR *rgwszCertType; //the array of certificate type name
  1154. }CRYPTUI_WIZ_CERT_TYPE, *PCRYPTUI_WIZ_CERT_TYPE;
  1155. typedef const CRYPTUI_WIZ_CERT_TYPE *PCCRYPTUI_WIZ_CERT_TYPE;
  1156. //-----------------------------------------------------------------------
  1157. // dwPvkChoice
  1158. //-----------------------------------------------------------------------
  1159. #define CRYPTUI_WIZ_CERT_REQUEST_PVK_CHOICE_CERT 1
  1160. #define CRYPTUI_WIZ_CERT_REQUEST_PVK_CHOICE_EXISTING 2
  1161. #define CRYPTUI_WIZ_CERT_REQUEST_PVK_CHOICE_NEW 3
  1162. //-----------------------------------------------------------------------
  1163. // dwPurpose
  1164. //-----------------------------------------------------------------------
  1165. #define CRYPTUI_WIZ_CERT_ENROLL 0x00010000
  1166. #define CRYPTUI_WIZ_CERT_RENEW 0x00020000
  1167. //-----------------------------------------------------------------------
  1168. //
  1169. // valid flags for dwPostOption
  1170. //-----------------------------------------------------------------------
  1171. //post the requested certificate on the directory serivce
  1172. #define CRYPTUI_WIZ_CERT_REQUEST_POST_ON_DS 0x01
  1173. //post the requested certificate with the private key container.
  1174. #define CRYPTUI_WIZ_CERT_REQUEST_POST_ON_CSP 0x02
  1175. //-----------------------------------------------------------------------
  1176. //
  1177. // valid flags for dwCertChoice
  1178. //-----------------------------------------------------------------------
  1179. #define CRYPTUI_WIZ_CERT_REQUEST_KEY_USAGE 0x01
  1180. #define CRYPTUI_WIZ_CERT_REQUEST_CERT_TYPE 0x02
  1181. //-------------------------------------------------------------------------
  1182. //
  1183. //
  1184. // CRYPTUI_WIZ_CERT_REQUEST_INFO
  1185. //-------------------------------------------------------------------------
  1186. typedef struct _CRYPTUI_WIZ_CERT_REQUEST_INFO
  1187. {
  1188. DWORD dwSize; //Required: Has to be set to sizeof(CRYPTUI_WIZ_CERT_REQUEST_INFO)
  1189. DWORD dwPurpose; //Required: If CRYPTUI_WIZ_CERT_ENROLL is set, a certificate will be enrolled,
  1190. // If CRYPTUI_WIZ_CERT_RENEW is set, a certificate will be renewed.
  1191. // CRYPTUI_WIZ_CERT_ENROLL and CRYPTUI_WIZ_CERT_RENEW can not be set
  1192. // at the same time
  1193. LPCWSTR pwszMachineName; //Optional: The machine name for which to enroll.
  1194. LPCWSTR pwszAccountName; //Optional: The account name(user or service) for which to enroll
  1195. //
  1196. // pwszMachineName pwszAccountName Meaning
  1197. //---------------------------------------------------
  1198. // NULL NULL Request for current account on the current machine
  1199. // "fooMachine" NULL Request for the machine named "fooMachine"
  1200. // NULL "fooUser" Request for the "fooUser" account on the current machine
  1201. // "fooMachine" "fooUser" Request for the "fooUser" accunt on the "fooMachine" machine
  1202. //
  1203. void *pAuthentication; //Reserved: authenticate info. Must be set to NULL.
  1204. LPCWSTR pCertRequestString; //Reserved: The additional request string. Must be set to NULL.
  1205. LPCWSTR pwszDesStore; //Optional: The desination store where to put
  1206. // the enrolled certificate. Default to "My" if the value is NULL
  1207. DWORD dwCertOpenStoreFlag; //Optional: The value passed to dwFlags of CertOpenStore for the
  1208. // destination store
  1209. // If this value is 0, we use CERT_SYSTEM_STORE_CURRENT_USER for
  1210. // an accout and CERT_SYSTEM_STORE_LOCAL_MACHINE for a machine
  1211. LPCSTR pszHashAlg; //Optional: The oid string of the hash algorithm of the certificate.
  1212. PCCERT_CONTEXT pRenewCertContext; //Required if CRYPTUI_WIZ_CERT_RENEW is set in dwPurpose
  1213. //Ignored otherwise and shoule be set to NULL.
  1214. DWORD dwPvkChoice; //Required: Specify the private key information
  1215. // CRYPTUI_WIZ_CERT_REQUEST_PVK_CHOICE_CERT
  1216. // CRYPTUI_WIZ_CERT_REQUEST_PVK_CHOICE_EXISTING
  1217. // CRYPTUI_WIZ_CERT_REQUEST_PVK_CHOICE_NEW
  1218. union //Required.
  1219. {
  1220. PCCRYPTUI_WIZ_CERT_REQUEST_PVK_CERT pPvkCert;
  1221. PCCRYPTUI_WIZ_CERT_REQUEST_PVK_EXISTING pPvkExisting;
  1222. PCCRYPTUI_WIZ_CERT_REQUEST_PVK_NEW pPvkNew;
  1223. };
  1224. LPCWSTR pwszCALocation; //Required if dwCertChoice==CRYPTUI_WIZ_CERT_REQUEST_KEY_USAGE //Optional Otherwise
  1225. //Optional Otherwise
  1226. // The machine name of the Certiviate Authority (CA)
  1227. LPCWSTR pwszCAName; //Required if dwCertChoice==CRYPTUI_WIZ_CERT_REQUEST_KEY_USAGE
  1228. //Optional Otherwise
  1229. // The name of the Certificate Authority (CA)
  1230. DWORD dwPostOption; //Optional Can set to any combination of the following flag:
  1231. // CRYPTUI_WIZ_CERT_REQUEST_POST_ON_DS
  1232. //
  1233. DWORD dwCertChoice; //Optional if CRYPTUI_WIZ_CERT_ENROLL is set in dwPurpose
  1234. // and CRYPTUI_WIZ_NO_UI is not set
  1235. //Required if CRYPTUI_WIZ_CERT_ENROLL is set in dwPurpose
  1236. // and CRYPTUI_WIZ_NO_UI is set
  1237. //ignored otherwise and should be set to 0.
  1238. // Specify the type of the requested certificate
  1239. // it can be one of the following flag:
  1240. // CRYPTUI_WIZ_CERT_REQUEST_KEY_USAGE
  1241. // CRYPTUI_WIZ_CERT_REQUEST_CERT_TYPE
  1242. union
  1243. {
  1244. PCERT_ENHKEY_USAGE pKeyUsage; // Indicate the enhanced key usage OIDs for the requested certificate.
  1245. PCCRYPTUI_WIZ_CERT_TYPE pCertType; // Indicate the certificate type of the requested certificate
  1246. };
  1247. LPCWSTR pwszFriendlyName; //Optional if CRYPTUI_WIZ_CERT_ENROLL is set in dwPurpose
  1248. //Ignored otherwise and should be set to NULL.
  1249. // The friendly name of the certificate
  1250. LPCWSTR pwszDescription; //Optional if CRYPTUI_WIZ_CERT_ENROLL is set in dwPurpose
  1251. //Ignored otherwise and should be set to NULL.
  1252. // The description of the certificate
  1253. PCERT_EXTENSIONS pCertRequestExtensions; //Optional The extensions to add to the certificate request
  1254. LPWSTR pwszCertDNName; //Optional The certificate DN string
  1255. }CRYPTUI_WIZ_CERT_REQUEST_INFO, *PCRYPTUI_WIZ_CERT_REQUEST_INFO;
  1256. typedef const CRYPTUI_WIZ_CERT_REQUEST_INFO *PCCRYPTUI_WIZ_CERT_REQUEST_INFO;
  1257. //-----------------------------------------------------------------------
  1258. //
  1259. // possible status for pdwStatus
  1260. // Those status indicate the status value returned
  1261. // from the certificate authority (certificate server).
  1262. //-----------------------------------------------------------------------
  1263. #define CRYPTUI_WIZ_CERT_REQUEST_STATUS_SUCCEEDED 0
  1264. #define CRYPTUI_WIZ_CERT_REQUEST_STATUS_REQUEST_ERROR 1
  1265. #define CRYPTUI_WIZ_CERT_REQUEST_STATUS_REQUEST_DENIED 2
  1266. #define CRYPTUI_WIZ_CERT_REQUEST_STATUS_ISSUED_SEPARATELY 3
  1267. #define CRYPTUI_WIZ_CERT_REQUEST_STATUS_UNDER_SUBMISSION 4
  1268. #define CRYPTUI_WIZ_CERT_REQUEST_STATUS_UNKNOWN 5
  1269. #define CRYPTUI_WIZ_CERT_REQUEST_STATUS_CERT_ISSUED 6
  1270. #define CRYPTUI_WIZ_CERT_REQUEST_STATUS_CONNECTION_FAILED 7
  1271. //-----------------------------------------------------------------------
  1272. //
  1273. // CryptUIWizCertRequest
  1274. //
  1275. // Request a certificate via a wizard.
  1276. //
  1277. // dwFlags: IN Optional
  1278. // If CRYPTUI_WIZ_NO_UI is set in dwFlags, no UI will be shown.
  1279. // If CRYPTUI_WIZ_NO_INSTALL_ROOT is set in dwFlags, the wizard will not
  1280. // install the issued certificate chain into the root store,
  1281. // instead, it will put the certificate chain into the CA store.
  1282. //
  1283. // hwndParent: IN Optional
  1284. // The parent window for the UI. Ignored if CRYPTUI_WIZ_NO_UI is set in dwFlags
  1285. //
  1286. // pwszWizardTitle: IN Optional
  1287. // The title of the wizard. Ignored if CRYPTUI_WIZ_NO_UI is set in dwFlags
  1288. //
  1289. // pCertRequestInfo: IN Required
  1290. // A pointer to CRYPTUI_WIZ_CERT_REQUEST_INFO struct
  1291. //
  1292. // ppCertContext: Out Optional
  1293. // The issued certificate. The certificate is in a memory store for remote enrollment.
  1294. // The certificate is in a system cert store for local enrollment.
  1295. //
  1296. // Even the function return TRUE, it does not mean the certificate is issued. Use should
  1297. // check for the *pdwCAStatus. If the status is CRYPTUI_WIZ_CERT_REQUEST_STATUS_ISSUED_SEPERATELY
  1298. // of CRYPTUI_WIZ_CERT_REQUEST_STATUS_UNDER_SUBMISSION, *ppCertContext will be NULL.
  1299. // It is valid only if *pdwCAStatus==CRYPTUI_WIZ_CERT_REQUEST_STATUS_SUCCEEDED
  1300. //
  1301. // pdwCAStatus: Out Optional.
  1302. // The return status of the certificate authority cerver. The dwStatus can be one of
  1303. /// the following:
  1304. // CRYPTUI_WIZ_CERT_REQUEST_STATUS_SUCCEEDED
  1305. // CRYPTUI_WIZ_CERT_REQUEST_STATUS_REQUEST_ERROR
  1306. // CRYPTUI_WIZ_CERT_REQUEST_STATUS_REQUEST_DENIED
  1307. // CRYPTUI_WIZ_CERT_REQUEST_STATUS_ISSUED_SEPERATELY
  1308. // CRYPTUI_WIZ_CERT_REQUEST_STATUS_UNDER_SUBMISSION
  1309. //------------------------------------------------------------------------
  1310. BOOL
  1311. WINAPI
  1312. CryptUIWizCertRequest(
  1313. IN DWORD dwFlags,
  1314. IN OPTIONAL HWND hwndParent,
  1315. IN OPTIONAL LPCWSTR pwszWizardTitle,
  1316. IN PCCRYPTUI_WIZ_CERT_REQUEST_INFO pCertRequestInfo,
  1317. OUT OPTIONAL PCCERT_CONTEXT *ppCertContext,
  1318. OUT OPTIONAL DWORD *pCAdwStatus
  1319. );
  1320. //-------------------------------------------------------------------------
  1321. //
  1322. // Valid values for dwSubjectChoice in IMPORT_SUBJECT_INFO
  1323. //-------------------------------------------------------------------------
  1324. #define CRYPTUI_WIZ_IMPORT_SUBJECT_FILE 1
  1325. #define CRYPTUI_WIZ_IMPORT_SUBJECT_CERT_CONTEXT 2
  1326. #define CRYPTUI_WIZ_IMPORT_SUBJECT_CTL_CONTEXT 3
  1327. #define CRYPTUI_WIZ_IMPORT_SUBJECT_CRL_CONTEXT 4
  1328. #define CRYPTUI_WIZ_IMPORT_SUBJECT_CERT_STORE 5
  1329. //-------------------------------------------------------------------------
  1330. //
  1331. // Struct to define the subject CertImportWizard
  1332. //
  1333. // CRYPTUI_WIZ_IMPORT_SUBJECT_INFO
  1334. //
  1335. //-------------------------------------------------------------------------
  1336. typedef struct _CRYPTUI_WIZ_IMPORT_SUBJECT_INFO
  1337. {
  1338. DWORD dwSize; //Required: should be set to sizeof(IMPORT_SUBJECT_INFO)
  1339. DWORD dwSubjectChoice; //Required: indicate the type of the subject:
  1340. // If can one of the following:
  1341. // CRYPTUI_WIZ_IMPORT_SUBJECT_FILE
  1342. // CRYPTUI_WIZ_IMPORT_SUBJECT_CERT_CONTEXT
  1343. // CRYPTUI_WIZ_IMPORT_SUBJECT_CTL_CONTEXT
  1344. // CRYPTUI_WIZ_IMPORT_SUBJECT_CRL_CONTEXT
  1345. // CRYPTUI_WIZ_IMPORT_SUBJECT_CERT_STORE
  1346. union
  1347. {
  1348. LPCWSTR pwszFileName;
  1349. PCCERT_CONTEXT pCertContext;
  1350. PCCTL_CONTEXT pCTLContext;
  1351. PCCRL_CONTEXT pCRLContext;
  1352. HCERTSTORE hCertStore;
  1353. };
  1354. DWORD dwFlags; //Required if pwszFileName contains a PFX BLOB.
  1355. //Ignored otherwise
  1356. //This is the same flag for PFXImportCertStore
  1357. LPCWSTR pwszPassword; //Required if pwszFileName contains a PFX BLOB.
  1358. //ignored otherwise
  1359. }CRYPTUI_WIZ_IMPORT_SRC_INFO, *PCRYPTUI_WIZ_IMPORT_SRC_INFO;
  1360. typedef const CRYPTUI_WIZ_IMPORT_SRC_INFO *PCCRYPTUI_WIZ_IMPORT_SRC_INFO;
  1361. //-----------------------------------------------------------------------
  1362. //
  1363. // Valid flags for dwFlags in CryptUIWizImport
  1364. //
  1365. //-----------------------------------------------------------------------
  1366. //if this flag is set in dwFlags, user will not be allowed to change
  1367. //the hDesCertStore in the wizard page
  1368. #define CRYPTUI_WIZ_IMPORT_NO_CHANGE_DEST_STORE 0x00010000
  1369. //Allow importing certificate
  1370. #define CRYPTUI_WIZ_IMPORT_ALLOW_CERT 0x00020000
  1371. //Allow importing certificate revocation list
  1372. #define CRYPTUI_WIZ_IMPORT_ALLOW_CRL 0x00040000
  1373. //Allow importing certificate trust list
  1374. #define CRYPTUI_WIZ_IMPORT_ALLOW_CTL 0x00080000
  1375. //-----------------------------------------------------------------------
  1376. //
  1377. // CryptUIWizImport
  1378. //
  1379. // The import wizard to import public key related files to a certificate
  1380. // store
  1381. //
  1382. // dwFlags can be set to any combination of the following flags:
  1383. // CRYPTUI_WIZ_NO_UI No UI will be shown. Otherwise, User will be
  1384. // prompted by a wizard.
  1385. // CRYPTUI_WIZ_IMPORT_ALLOW_CERT Allow importing certificate
  1386. // CRYPTUI_WIZ_IMPORT_ALLOW_CRL Allow importing CRL(certificate revocation list)
  1387. // CRYPTUI_WIZ_IMPORT_ALLOW_CTL Allow importing CTL(certificate trust list)
  1388. // CRYPTUI_WIZ_IMPORT_NO_CHANGE_DEST_STORE user will not be allowed to change
  1389. // the hDesCertStore in the wizard page
  1390. // Please notice that if neither of following three flags is in dwFlags, default to is
  1391. // allow everything.
  1392. // CRYPTUI_WIZ_IMPORT_ALLOW_CERT
  1393. // CRYPTUI_WIZ_IMPORT_ALLOW_CRL
  1394. // CRYPTUI_WIZ_IMPORT_ALLOW_CTL
  1395. //
  1396. //
  1397. //
  1398. // If CRYPTUI_WIZ_NO_UI is set in dwFlags:
  1399. // hwndParent: Ignored
  1400. // pwszWizardTitle: Ignored
  1401. // pImportSubject: IN Required: The subject to import.
  1402. // hDesCertStore: IN Optional: The destination certficate store
  1403. //
  1404. // If CRYPTUI_WIZ_NO_UI is not set in dwFlags:
  1405. // hwndPrarent: IN Optional: The parent window for the wizard
  1406. // pwszWizardTitle: IN Optional: The title of the wizard
  1407. // If NULL, the default will be IDS_IMPORT_WIZARD_TITLE
  1408. // pImportSubject: IN Optional: The file name to import.
  1409. // If NULL, the wizard will prompt user to enter the file name
  1410. // hDesCertStore: IN Optional: The destination certificate store where the file wil be
  1411. // imported to. The store should be opened with
  1412. // flag CERT_STORE_SET_LOCALIZED_NAME_FLAG. If NULL, the wizard will prompt user to select
  1413. // a certificate store.
  1414. //------------------------------------------------------------------------
  1415. BOOL
  1416. WINAPI
  1417. CryptUIWizImport(
  1418. DWORD dwFlags,
  1419. HWND hwndParent,
  1420. LPCWSTR pwszWizardTitle,
  1421. PCCRYPTUI_WIZ_IMPORT_SRC_INFO pImportSrc,
  1422. HCERTSTORE hDestCertStore
  1423. );
  1424. //-------------------------------------------------------------------------
  1425. //
  1426. // Struct to define the information needed to build a new CTL
  1427. //
  1428. // CRYPTUI_WIZ_BUILDCTL_NEW_CTL_INFO
  1429. //
  1430. //
  1431. //-------------------------------------------------------------------------
  1432. typedef struct _CRYPTUI_WIZ_BUILDCTL_NEW_CTL_INFO
  1433. {
  1434. DWORD dwSize; //Required: should be set to sizeof(CRYPTUI_WIZ_BUILDCTL_NEW_CTL)
  1435. PCERT_ENHKEY_USAGE pSubjectUsage; //Optioanl: The purpose of the CTL
  1436. LPWSTR pwszListIdentifier; //Optional: The string to identify the CTL
  1437. LPCSTR pszSubjectAlgorithm; //Optional: The hashing algorithm.
  1438. // Currently, only SHA1 or MD5 hashing is supported
  1439. HCERTSTORE hCertStore; //Optional: The certificate in the CTL. Only the certificates
  1440. // with the enhanced key usage specified by pSubjectUsage
  1441. // will be included in the CTL
  1442. FILETIME NextUpdate; //Optional: The next update time of the CTL. If the value
  1443. // is more than 99 month from the current system time,
  1444. // the value will be ignored.
  1445. LPWSTR pwszFriendlyName; //Optional: The friendly name of the CTL
  1446. LPWSTR pwszDescription; //Optional: The description of the CTL
  1447. }CRYPTUI_WIZ_BUILDCTL_NEW_CTL_INFO, *PCRYPTUI_WIZ_BUILDCTL_NEW_CTL_INFO;
  1448. typedef const CRYPTUI_WIZ_BUILDCTL_NEW_CTL_INFO *PCCRYPTUI_WIZ_BUILDCTL_NEW_CTL_INFO;
  1449. //-------------------------------------------------------------------------
  1450. //
  1451. // Valid values for dwSourceChoice for CRYPTUI_WIZ_BUILDCTL_SRC_INFO
  1452. //-------------------------------------------------------------------------
  1453. #define CRYPTUI_WIZ_BUILDCTL_SRC_EXISTING_CTL 1
  1454. #define CRYPTUI_WIZ_BUILDCTL_SRC_NEW_CTL 2
  1455. //-------------------------------------------------------------------------
  1456. //
  1457. // Struct to define the source of certBuildCTL wizard
  1458. //
  1459. // CRYPTUI_WIZ_BUILDCTL_SRC_INFO
  1460. //
  1461. //
  1462. //-------------------------------------------------------------------------
  1463. typedef struct _CRYPTUI_WIZ_BUILDCTL_SRC_INFO
  1464. {
  1465. DWORD dwSize; //Required: should be set to sizeof(CRYPTUI_WIZ_BUILDCTL_SRC_INFO)
  1466. DWORD dwSourceChoice; //Required: indicate the source from which to build the CTL
  1467. // if can be one of the following:
  1468. // CRYPTUI_WIZ_BUILDCTL_SRC_EXISTING_CTL
  1469. // CRYPTUI_WIZ_BUILDCTL_SRC_NEW_CTL
  1470. union
  1471. {
  1472. PCCTL_CONTEXT pCTLContext; //Required if dwSourceChoice == CRYPTUI_WIZ_BUILDCTL_SRC_EXISTING_CTL
  1473. // An existing CTL based on which a new CTL is to be built
  1474. PCCRYPTUI_WIZ_BUILDCTL_NEW_CTL_INFO pNewCTLInfo; //Required if dwSourceChoise == CRYPTUI_WIZ_BUILDCTL_SRC_NEW_CTL
  1475. };
  1476. }CRYPTUI_WIZ_BUILDCTL_SRC_INFO, *PCRYPTUI_WIZ_BUILDCTL_SRC_INFO;
  1477. typedef const CRYPTUI_WIZ_BUILDCTL_SRC_INFO *PCCRYPTUI_WIZ_BUILDCTL_SRC_INFO;
  1478. //-------------------------------------------------------------------------
  1479. //
  1480. // Valid values for dwDestinationChoice for CRYPTUI_WIZ_BUILDCTL_DEST_INFO
  1481. //-------------------------------------------------------------------------
  1482. #define CRYPTUI_WIZ_BUILDCTL_DEST_CERT_STORE 1
  1483. #define CRYPTUI_WIZ_BUILDCTL_DEST_FILE 2
  1484. //-------------------------------------------------------------------------
  1485. //
  1486. // Struct to define the desination of certBuildCTL wizard
  1487. //
  1488. // CRYPTUI_WIZ_BUILDCTL_DEST_INFO
  1489. //
  1490. //
  1491. //-------------------------------------------------------------------------
  1492. typedef struct _CRYPTUI_WIZ_BUILDCTL_DEST_INFO
  1493. {
  1494. DWORD dwSize; //Required: should be set to sizeof(CRYPTUI_WIZ_BUILDCTL_DEST_INFO)
  1495. DWORD dwDestinationChoice; //Required: indicate the type of the desination:
  1496. // If can one of the following:
  1497. // CRYPTUI_WIZ_BUILDCTL_DEST_CERT_STORE
  1498. // CRYPTUI_WIZ_BUILDCTL_DEST_FILE
  1499. union
  1500. {
  1501. LPCWSTR pwszFileName;
  1502. HCERTSTORE hCertStore;
  1503. };
  1504. }CRYPTUI_WIZ_BUILDCTL_DEST_INFO, *PCRYPTUI_WIZ_BUILDCTL_DEST_INFO;
  1505. typedef const CRYPTUI_WIZ_BUILDCTL_DEST_INFO *PCCRYPTUI_WIZ_BUILDCTL_DEST_INFO;
  1506. //-----------------------------------------------------------------------
  1507. //
  1508. // CryptUIWizBuildCTL
  1509. //
  1510. // Build a new CTL or modify an existing CTL. The UI for wizard will
  1511. // always show in this case
  1512. //
  1513. //
  1514. // dwFlags: IN Optional: Can be set to the any combination of the following:
  1515. // CRYPTUI_WIZ_BUILDCTL_SKIP_DESTINATION.
  1516. // CRYPTUI_WIZ_BUILDCTL_SKIP_SIGNING
  1517. // CRYPTUI_WIZ_BUILDCTL_SKIP_PURPOSE
  1518. // hwndParnet: IN Optional: The parent window handle
  1519. // pwszWizardTitle: IN Optional: The title of the wizard
  1520. // If NULL, the default will be IDS_BUILDCTL_WIZARD_TITLE
  1521. // pBuildCTLSrc: IN Optional: The source from which the CTL will be built
  1522. // pBuildCTLDest: IN Optional: The desination where the newly
  1523. // built CTL will be stored
  1524. // ppCTLContext: OUT Optaionl: The newly build CTL
  1525. //
  1526. //------------------------------------------------------------------------
  1527. BOOL
  1528. WINAPI
  1529. CryptUIWizBuildCTL(
  1530. IN DWORD dwFlags,
  1531. IN OPTIONAL HWND hwndParent,
  1532. IN OPTIONAL LPCWSTR pwszWizardTitle,
  1533. IN OPTIONAL PCCRYPTUI_WIZ_BUILDCTL_SRC_INFO pBuildCTLSrc,
  1534. IN OPTIONAL PCCRYPTUI_WIZ_BUILDCTL_DEST_INFO pBuildCTLDest,
  1535. OUT OPTIONAL PCCTL_CONTEXT *ppCTLContext
  1536. );
  1537. //-------------------------------------------------------------------------
  1538. //
  1539. // Valid values for dwSubjectChoice in CRYPTUI_WIZ_EXPORT_INFO
  1540. //-------------------------------------------------------------------------
  1541. #define CRYPTUI_WIZ_EXPORT_CERT_CONTEXT 1
  1542. #define CRYPTUI_WIZ_EXPORT_CTL_CONTEXT 2
  1543. #define CRYPTUI_WIZ_EXPORT_CRL_CONTEXT 3
  1544. #define CRYPTUI_WIZ_EXPORT_CERT_STORE 4
  1545. #define CRYPTUI_WIZ_EXPORT_CERT_STORE_CERTIFICATES_ONLY 5
  1546. //-------------------------------------------------------------------------
  1547. //
  1548. // Struct to define the object to be exported and where to export it to
  1549. //
  1550. // CRYPTUI_WIZ_EXPORT_SUBJECT_INFO
  1551. //
  1552. //-------------------------------------------------------------------------
  1553. typedef struct _CRYPTUI_WIZ_EXPORT_INFO
  1554. {
  1555. DWORD dwSize; //Required: should be set to sizeof(CRYPTUI_WIZ_EXPORT_INFO)
  1556. LPCWSTR pwszExportFileName; //Required if the CRYPTUI_WIZ_NO_UI flag is set, Optional otherwise.
  1557. //The fully qualified file name to export to, if this is
  1558. //non-NULL and the CRYPTUI_WIZ_NO_UI flag is NOT set, then it is
  1559. //displayed to the user as the default file name
  1560. DWORD dwSubjectChoice; //Required: indicate the type of the subject:
  1561. // If can one of the following:
  1562. // CRYPTUI_WIZ_EXPORT_CERT_CONTEXT
  1563. // CRYPTUI_WIZ_EXPORT_CTL_CONTEXT
  1564. // CRYPTUI_WIZ_EXPORT_CRL_CONTEXT
  1565. // CRYPTUI_WIZ_EXPORT_CERT_STORE
  1566. // CRYPTUI_WIZ_EXPORT_CERT_STORE_CERTIFICATES_ONLY
  1567. union
  1568. {
  1569. PCCERT_CONTEXT pCertContext;
  1570. PCCTL_CONTEXT pCTLContext;
  1571. PCCRL_CONTEXT pCRLContext;
  1572. HCERTSTORE hCertStore;
  1573. };
  1574. DWORD cStores; // Optional: count of extra stores to search for the certs in the
  1575. // trust chain if the chain is being exported with a cert.
  1576. // this is ignored if dwSubjectChoice is anything other
  1577. // than CRYPTUI_WIZ_EXPORT_CERT_CONTEXT
  1578. HCERTSTORE * rghStores; // Optional: array of extra stores to search for the certs in the
  1579. // trust chain if the chain is being exported with a cert.
  1580. // this is ignored if dwSubjectChoice is anything other
  1581. // than CRYPTUI_WIZ_EXPORT_CERT_CONTEXT
  1582. }CRYPTUI_WIZ_EXPORT_INFO, *PCRYPTUI_WIZ_EXPORT_INFO;
  1583. typedef const CRYPTUI_WIZ_EXPORT_INFO *PCCRYPTUI_WIZ_EXPORT_INFO;
  1584. //-------------------------------------------------------------------------
  1585. //
  1586. // Valid values for dwExportFormat in CRYPTUI_WIZ_EXPORT_CERTCONTEXT_INFO
  1587. //-------------------------------------------------------------------------
  1588. #define CRYPTUI_WIZ_EXPORT_FORMAT_DER 1
  1589. #define CRYPTUI_WIZ_EXPORT_FORMAT_PFX 2
  1590. #define CRYPTUI_WIZ_EXPORT_FORMAT_PKCS7 3
  1591. #define CRYPTUI_WIZ_EXPORT_FORMAT_BASE64 4
  1592. #define CRYPTUI_WIZ_EXPORT_FORMAT_SERIALIZED_CERT_STORE 5 // NOTE: not currently supported!!
  1593. //-------------------------------------------------------------------------
  1594. //
  1595. // Struct to define the information needed to export a CERT_CONTEXT
  1596. //
  1597. // CRYPTUI_WIZ_EXPORT_NOUI_INFO
  1598. //
  1599. //-------------------------------------------------------------------------
  1600. typedef struct _CRYPTUI_WIZ_EXPORT_CERTCONTEXT_INFO
  1601. {
  1602. DWORD dwSize; //Required: should be set to sizeof(CRYPTUI_WIZ_EXPORT_NOUI_INFO)
  1603. DWORD dwExportFormat; //Required:
  1604. // It can be one of the following:
  1605. // CRYPTUI_WIZ_EXPORT_FORMAT_DER
  1606. // CRYPTUI_WIZ_EXPORT_FORMAT_PFX
  1607. // CRYPTUI_WIZ_EXPORT_FORMAT_PKCS7
  1608. // CRYPTUI_WIZ_EXPORT_FORMAT_SERIALIZED_CERT_STORE
  1609. BOOL fExportChain; //Required
  1610. BOOL fExportPrivateKeys; //Required
  1611. LPCWSTR pwszPassword; //Required if the fExportPrivateKeys boolean is TRUE, otherwise,
  1612. //it is ignored
  1613. BOOL fStrongEncryption; //Required if dwExportFormat is CRYPTUI_WIZ_EXPORT_FORMAT_PFX
  1614. //Note that if this flag is TRUE then the PFX blob produced is
  1615. //NOT compatible with IE4.
  1616. }CRYPTUI_WIZ_EXPORT_CERTCONTEXT_INFO, *PCRYPTUI_WIZ_EXPORT_CERTCONTEXT_INFO;
  1617. typedef const CRYPTUI_WIZ_EXPORT_CERTCONTEXT_INFO *PCCRYPTUI_WIZ_EXPORT_CERTCONTEXT_INFO;
  1618. //-----------------------------------------------------------------------
  1619. //
  1620. // CryptUIWizExport
  1621. //
  1622. // The export wizard to export public key related objects to a file
  1623. //
  1624. // If dwFlags is set to CRYPTUI_WIZ_NO_UI, no UI will be shown. Otherwise,
  1625. // User will be prompted for input through a wizard.
  1626. //
  1627. // If CRYPTUI_WIZ_NO_UI is set in dwFlags:
  1628. // hwndParent: Ignored
  1629. // pwszWizardTitle: Ignored
  1630. // pExportInfo: IN Required: The subject to export.
  1631. // pvoid: IN Required: Contains information about how to do the export based on what
  1632. // is being exported
  1633. //
  1634. // dwSubjectChoice INPUT TYPE
  1635. // -------------------------------------------------------------------------
  1636. // CRYPTUI_WIZ_EXPORT_CERT_CONTEXT PCCRYPTUI_WIZ_EXPORT_CERTCONTEXT_INFO
  1637. // CRYPTUI_WIZ_EXPORT_CTL_CONTEXT NULL
  1638. // CRYPTUI_WIZ_EXPORT_CRL_CONTEXT NULL
  1639. // CRYPTUI_WIZ_EXPORT_CERT_STORE NULL
  1640. //
  1641. // If CRYPTUI_WIZ_NO_UI is not set in dwFlags:
  1642. // hwndPrarent: IN Optional: The parent window for the wizard
  1643. // pwszWizardTitle: IN Optional: The title of the wizard
  1644. // If NULL, the default will be IDS_EXPORT_WIZARD_TITLE
  1645. // pExportInfo: IN Required: The subject to export.
  1646. // pvoid: IN Optional: Contains information about how to do the export based on what
  1647. // is being exported. See above table for values, if this is non-NULL
  1648. // the values are displayed to the user as the default choices.
  1649. //------------------------------------------------------------------------
  1650. BOOL
  1651. WINAPI
  1652. CryptUIWizExport(
  1653. DWORD dwFlags,
  1654. HWND hwndParent,
  1655. LPCWSTR pwszWizardTitle,
  1656. PCCRYPTUI_WIZ_EXPORT_INFO pExportInfo,
  1657. void *pvoid
  1658. );
  1659. //-------------------------------------------------------------------------
  1660. //valid values for dwSubjectChoice in CRYPTUI_WIZ_DIGITAL_SIGN_INFO struct
  1661. //-------------------------------------------------------------------------
  1662. #define CRYPTUI_WIZ_DIGITAL_SIGN_SUBJECT_FILE 0x01
  1663. #define CRYPTUI_WIZ_DIGITAL_SIGN_SUBJECT_BLOB 0x02
  1664. //-------------------------------------------------------------------------
  1665. //valid values for dwSigningCertChoice in CRYPTUI_WIZ_DIGITAL_SIGN_INFO struct
  1666. //-------------------------------------------------------------------------
  1667. #define CRYPTUI_WIZ_DIGITAL_SIGN_CERT 0x01
  1668. #define CRYPTUI_WIZ_DIGITAL_SIGN_STORE 0x02
  1669. #define CRYPTUI_WIZ_DIGITAL_SIGN_PVK 0x03
  1670. //-------------------------------------------------------------------------
  1671. //valid values for dwAddtionalCertChoice in CRYPTUI_WIZ_DIGITAL_SIGN_INFO struct
  1672. //-------------------------------------------------------------------------
  1673. //include the entire certificate trust chain in the signature
  1674. #define CRYPTUI_WIZ_DIGITAL_SIGN_ADD_CHAIN 0x00000001
  1675. //include the entilre certificate trust chain, with the exception of the root
  1676. //certificate, in the signature
  1677. #define CRYPTUI_WIZ_DIGITAL_SIGN_ADD_CHAIN_NO_ROOT 0x00000002
  1678. //-------------------------------------------------------------------------
  1679. //
  1680. // CRYPTUI_WIZ_DIGITAL_SIGN_BLOB_INFO
  1681. //
  1682. // dwSize IN Required: should be set to sizeof(CRYPTUI_WIZ_DIGITAL_SIGN_BLOB_INFO)
  1683. // pGuidSubject IN Required: Idenfity the sip functions to load
  1684. // cbBlob IN Required: the size of BLOB, in bytes
  1685. // pbBlob IN Required: the pointer to the BLOB
  1686. // pwszDispalyName IN Optional: the display name of the BLOB to sign.
  1687. //-------------------------------------------------------------------------
  1688. typedef struct _CRYPTUI_WIZ_DIGITAL_SIGN_BLOB_INFO
  1689. {
  1690. DWORD dwSize;
  1691. GUID *pGuidSubject;
  1692. DWORD cbBlob;
  1693. BYTE *pbBlob;
  1694. LPCWSTR pwszDisplayName;
  1695. }CRYPTUI_WIZ_DIGITAL_SIGN_BLOB_INFO, *PCRYPTUI_WIZ_DIGITAL_SIGN_BLOB_INFO;
  1696. typedef const CRYPTUI_WIZ_DIGITAL_SIGN_BLOB_INFO *PCCRYPTUI_WIZ_DIGITAL_SIGN_BLOB_INFO;
  1697. //-------------------------------------------------------------------------
  1698. //
  1699. // CRYPTUI_WIZ_DIGITAL_SIGN_STORE_INFO
  1700. //
  1701. // dwSize IN Required: should be set to sizeof(CRYPTUI_WIZ_DIGITAL_SIGN_STORE_INFO)
  1702. // cCertStore IN Required: The acount of certificate store array that includes potentical sining certs
  1703. // rghCertStore IN Required: The certificate store array that includes potential signing certs
  1704. // pFilterCallback IN Optional: The filter call back function for display the certificate
  1705. // pvCallbackData IN Optional: The call back data
  1706. //-------------------------------------------------------------------------
  1707. typedef struct _CRYPTUI_WIZ_DIGITAL_SIGN_STORE_INFO
  1708. {
  1709. DWORD dwSize;
  1710. DWORD cCertStore;
  1711. HCERTSTORE *rghCertStore;
  1712. PFNCFILTERPROC pFilterCallback;
  1713. void * pvCallbackData;
  1714. }CRYPTUI_WIZ_DIGITAL_SIGN_STORE_INFO, *PCRYPTUI_WIZ_DIGITAL_SIGN_STORE_INFO;
  1715. typedef const CRYPTUI_WIZ_DIGITAL_SIGN_STORE_INFO *PCCRYPTUI_WIZ_DIGITAL_SIGN_STORE_INFO;
  1716. //-------------------------------------------------------------------------
  1717. //
  1718. // CRYPTUI_WIZ_DIGITAL_SIGN_PVK_FILE_INFO
  1719. //
  1720. // dwSize IN Required: should be set to sizeof(CRYPT_WIZ_DIGITAL_SIGN_PVK_FILE_INFO)
  1721. // pwszPvkFileName IN Required: the PVK file name
  1722. // pwszProvName IN Required: the provider name
  1723. // dwProvType IN Required: the provider type
  1724. //
  1725. //-------------------------------------------------------------------------
  1726. typedef struct _CRYPTUI_WIZ_DIGITAL_SIGN_PVK_FILE_INFO
  1727. {
  1728. DWORD dwSize;
  1729. LPWSTR pwszPvkFileName;
  1730. LPWSTR pwszProvName;
  1731. DWORD dwProvType;
  1732. }CRYPTUI_WIZ_DIGITAL_SIGN_PVK_FILE_INFO, *PCRYPTUI_WIZ_DIGITAL_SIGN_PVK_FILE_INFO;
  1733. typedef const CRYPTUI_WIZ_DIGITAL_SIGN_PVK_FILE_INFO *PCCRYPTUI_WIZ_DIGITAL_SIGN_PVK_FILE_INFO;
  1734. //-------------------------------------------------------------------------
  1735. //
  1736. // valid values for dwPvkChoice in CRYPTUI_WIZ_DIGITAL_SIGN_CERT_PVK_INFO struct
  1737. //-------------------------------------------------------------------------
  1738. #define CRYPTUI_WIZ_DIGITAL_SIGN_PVK_FILE 0x01
  1739. #define CRYPTUI_WIZ_DIGITAL_SIGN_PVK_PROV 0x02
  1740. //-------------------------------------------------------------------------
  1741. //
  1742. // CRYPTUI_WIZ_DIGITAL_SIGN_CERT_PVK_INFO
  1743. //
  1744. // dwSize IN Required: should be set to sizeof(CRYPTUI_WIZ_DIGITAL_SIGN_STORE_INFO)
  1745. // pwszSigningCertFileName IN Required: the file name that contains the signing cert(s)
  1746. // dwPvkChoice IN Required: Indicate the private key type:
  1747. // It can be one of the following:
  1748. // CRYPTUI_WIZ_DIGITAL_SIGN_PVK_FILE
  1749. // CRYPTUI_WIZ_DIGITAL_SIGN_PVK_PROV
  1750. // pPvkFileInfo IN Required if dwPvkChoice == CRYPTUI_WIZ_DIGITAL_SIGN_PVK_FILE
  1751. // pPvkProvInfo IN Required if dwPvkContainer== CRYPTUI_WIZ_DIGITAL_SIGN_PVK_PROV
  1752. //
  1753. //-------------------------------------------------------------------------
  1754. typedef struct _CRYPTUI_WIZ_DIGITAL_SIGN_CERT_PVK_INFO
  1755. {
  1756. DWORD dwSize;
  1757. LPWSTR pwszSigningCertFileName;
  1758. DWORD dwPvkChoice;
  1759. union
  1760. {
  1761. PCCRYPTUI_WIZ_DIGITAL_SIGN_PVK_FILE_INFO pPvkFileInfo;
  1762. PCRYPT_KEY_PROV_INFO pPvkProvInfo;
  1763. };
  1764. }CRYPTUI_WIZ_DIGITAL_SIGN_CERT_PVK_INFO, *PCRYPTUI_WIZ_DIGITAL_SIGN_CERT_PVK_INFO;
  1765. typedef const CRYPTUI_WIZ_DIGITAL_SIGN_CERT_PVK_INFO *PCCRYPTUI_WIZ_DIGITAL_SIGN_CERT_PVK_INFO;
  1766. //-------------------------------------------------------------------------
  1767. //
  1768. // valid values for dwAttrFlags in CRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO struct
  1769. //-------------------------------------------------------------------------
  1770. #define CRYPTUI_WIZ_DIGITAL_SIGN_COMMERCIAL 0x0001
  1771. #define CRYPTUI_WIZ_DIGITAL_SIGN_INDIVIDUAL 0x0002
  1772. //-------------------------------------------------------------------------
  1773. //
  1774. // CRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO
  1775. //
  1776. // dwSize IN Required: should be set to sizeof(CRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO)
  1777. // dwAttrFlags IN Required: Flag to indicate signing options.
  1778. // It can be one of the following:
  1779. // CRYPTUI_WIZ_DIGITAL_SIGN_COMMERCIAL
  1780. // CRYPTUI_WIZ_DIGITAL_SIGN_INDIVIDUAL
  1781. // pwszDescription IN Optional: The description of the signing subject
  1782. // pwszMoreInfoLocation IN Optional: the localtion to get more information about file
  1783. // this information will be shown upon download time
  1784. // pszHashAlg IN Optional: the hashing algorithm for the signature
  1785. // NULL means using SHA1 hashing algorithm
  1786. // pwszSigningCertDisplayString IN Optional: The display string to be displayed on the
  1787. // signing certificate wizard page. The string should
  1788. // prompt user to select a certificate for a particular purpose
  1789. // hAddtionalCertStores IN Optional: the addtional cert store to add to the signature
  1790. // psAuthenticated IN Optional: user supplied authenticated attributes added to the signature
  1791. // psUnauthenticated IN Optional: user supplied unauthenticated attributes added to the signature
  1792. //
  1793. //-------------------------------------------------------------------------
  1794. typedef struct _CRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO
  1795. {
  1796. DWORD dwSize;
  1797. DWORD dwAttrFlags;
  1798. LPCWSTR pwszDescription;
  1799. LPCWSTR pwszMoreInfoLocation;
  1800. LPCSTR pszHashAlg;
  1801. LPCWSTR pwszSigningCertDisplayString;
  1802. HCERTSTORE hAdditionalCertStore;
  1803. PCRYPT_ATTRIBUTES psAuthenticated;
  1804. PCRYPT_ATTRIBUTES psUnauthenticated;
  1805. }CRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO, *PCRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO;
  1806. typedef const CRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO *PCCRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO;
  1807. //-------------------------------------------------------------------------
  1808. //
  1809. //
  1810. // CRYPTUI_WIZ_DIGITAL_SIGN_INFO
  1811. //
  1812. // dwSize IN Required: Has to be set to sizeof(CRYPTUI_WIZ_DIGITAL_SIGN_INFO)
  1813. // dwSubjectChoice IN Required if CRYPTUI_WIZ_NO_UI is set in dwFlags of the CryptUIWizDigitalSigning, :
  1814. // Optional if CRYPTUI_WIZ_NO_UI is not set in dwFlags of the CryptUIWizDigitalSigning
  1815. // Indicate whether to sign a file or to sign a memory BLOB.
  1816. // 0 means promting user for the file to sign
  1817. // It can be one of the following:
  1818. // CRYPTUI_WIZ_DIGITAL_SIGN_SUBJECT_FILE
  1819. // CRYPTUI_WIZ_DIGITAL_SIGN_SUBJECT_BLOB
  1820. //
  1821. //
  1822. //pwszFileName IN Required if dwSubjectChoice==CRYPTUI_WIZ_DIGITAL_SIGN_SUBJECT_FILE
  1823. //pSignBlobInfo IN Required if dwSubhectChoice==CRYPTUI_WIZ_DIGITAL_SIGN_SUBJECT_BLOB
  1824. //
  1825. //dwSigningCertChoice IN Optional: Indicate the signing certificate.
  1826. // 0 means using the certificates in "My" store"
  1827. // It can be one of the following choices:
  1828. // CRYPTUI_WIZ_DIGITAL_SIGN_CERT
  1829. // CRYPTUI_WIZ_DIGITAL_SIGN_STORE
  1830. // CRYPTUI_WIZ_DIGITAL_SIGN_PVK
  1831. // If CRYPTUI_WIZ_NO_UI is set in dwFlags of the CryptUIWizDigitalSigning,
  1832. // dwSigningCertChoice has to be CRYPTUI_WIZ_DIGITAL_SIGN_CERT or
  1833. // CRYPTUI_WIZ_DIGITAL_SIGN_PVK
  1834. //
  1835. //pSigningCertContext IN Required if dwSigningCertChoice==CRYPTUI_WIZ_DIGITAL_SIGN_CERT
  1836. //pSigningCertStore IN Required if dwSigningCertChoice==CRYPTUI_WIZ_DIGITAL_SIGN_STORE
  1837. //pSigningCertPvkInfo IN Required if dwSigningCertChoise==CRYPTUI_WIZ_DIGITAL_SIGN_PVK
  1838. //
  1839. //pwszTimestampURL IN Optional: The timestamp URL address
  1840. //
  1841. //dwAdditionalCertChoice IN Optional: Indicate additional certificates to be included in the signature. //
  1842. // 0 means no addtional certificates will be added
  1843. // The following flags are mutually exclusive.
  1844. // Only one of them can be set:
  1845. // CRYPTUI_WIZ_DIGITAL_SIGN_ADD_CHAIN
  1846. // CRYPTUI_WIZ_DIGITAL_SIGN_ADD_CHAIN_NO_ROOT
  1847. //
  1848. //
  1849. //pSignExtInfo IN Optional: The extended information for signing
  1850. //
  1851. //-------------------------------------------------------------------------
  1852. typedef struct _CRYPTUI_WIZ_DIGITAL_SIGN_INFO
  1853. {
  1854. DWORD dwSize;
  1855. DWORD dwSubjectChoice;
  1856. union
  1857. {
  1858. LPCWSTR pwszFileName;
  1859. PCCRYPTUI_WIZ_DIGITAL_SIGN_BLOB_INFO pSignBlobInfo;
  1860. };
  1861. DWORD dwSigningCertChoice;
  1862. union
  1863. {
  1864. PCCERT_CONTEXT pSigningCertContext;
  1865. PCCRYPTUI_WIZ_DIGITAL_SIGN_STORE_INFO pSigningCertStore;
  1866. PCCRYPTUI_WIZ_DIGITAL_SIGN_CERT_PVK_INFO pSigningCertPvkInfo;
  1867. };
  1868. LPCWSTR pwszTimestampURL;
  1869. DWORD dwAdditionalCertChoice;
  1870. PCCRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO pSignExtInfo;
  1871. }CRYPTUI_WIZ_DIGITAL_SIGN_INFO, *PCRYPTUI_WIZ_DIGITAL_SIGN_INFO;
  1872. typedef const CRYPTUI_WIZ_DIGITAL_SIGN_INFO *PCCRYPTUI_WIZ_DIGITAL_SIGN_INFO;
  1873. //-------------------------------------------------------------------------
  1874. //
  1875. // CRYPTUI_WIZ_DIGITAL_SIGN_CONTEXT
  1876. //
  1877. // dwSize set to sizeof(CRYPTUI_WIZ_DIGITAL_SIGN_CONTEXT)
  1878. // cbBlob the size of pbBlob. In bytes
  1879. // pbBlob the signed BLOB
  1880. //-------------------------------------------------------------------------
  1881. typedef struct _CRYPTUI_WIZ_DIGITAL_SIGN_CONTEXT
  1882. {
  1883. DWORD dwSize;
  1884. DWORD cbBlob;
  1885. BYTE *pbBlob;
  1886. }CRYPTUI_WIZ_DIGITAL_SIGN_CONTEXT, *PCRYPTUI_WIZ_DIGITAL_SIGN_CONTEXT;
  1887. typedef const CRYPTUI_WIZ_DIGITAL_SIGN_CONTEXT *PCCRYPTUI_WIZ_DIGITAL_SIGN_CONTEXT;
  1888. //-----------------------------------------------------------------------
  1889. //
  1890. // CryptUIWizDigitalSign
  1891. //
  1892. // The wizard to digitally sign a document or a BLOB.
  1893. //
  1894. // If CRYPTUI_WIZ_NO_UI is set in dwFlags, no UI will be shown. Otherwise,
  1895. // User will be prompted for input through a wizard.
  1896. //
  1897. // dwFlags: IN Required:
  1898. // hwndParnet: IN Optional: The parent window handle
  1899. // pwszWizardTitle: IN Optional: The title of the wizard
  1900. // If NULL, the default will be IDS_DIGITAL_SIGN_WIZARD_TITLE
  1901. // pDigitalSignInfo: IN Required: The information about the signing process
  1902. // ppSignContext OUT Optional: The context pointer points to the signed BLOB
  1903. //------------------------------------------------------------------------
  1904. BOOL
  1905. WINAPI
  1906. CryptUIWizDigitalSign(
  1907. IN DWORD dwFlags,
  1908. IN OPTIONAL HWND hwndParent,
  1909. IN OPTIONAL LPCWSTR pwszWizardTitle,
  1910. IN PCCRYPTUI_WIZ_DIGITAL_SIGN_INFO pDigitalSignInfo,
  1911. OUT OPTIONAL PCCRYPTUI_WIZ_DIGITAL_SIGN_CONTEXT *ppSignContext);
  1912. BOOL
  1913. WINAPI
  1914. CryptUIWizFreeDigitalSignContext(
  1915. IN PCCRYPTUI_WIZ_DIGITAL_SIGN_CONTEXT pSignContext);
  1916. //-------------------------------------------------------------------------
  1917. //valid values for dwPageChoice in CRYPTUI_WIZ_SIGN_GET_PAGE_INFO
  1918. //-------------------------------------------------------------------------
  1919. #define CRYPTUI_WIZ_DIGITAL_SIGN_TYPICAL_SIGNING_OPTION_PAGES 0x0001
  1920. #define CRYPTUI_WIZ_DIGITAL_SIGN_MINIMAL_SIGNING_OPTION_PAGES 0x0002
  1921. #define CRYPTUI_WIZ_DIGITAL_SIGN_CUSTOM_SIGNING_OPTION_PAGES 0x0004
  1922. #define CRYPTUI_WIZ_DIGITAL_SIGN_ALL_SIGNING_OPTION_PAGES 0x0008
  1923. #define CRYPTUI_WIZ_DIGITAL_SIGN_WELCOME_PAGE 0x0100
  1924. #define CRYPTUI_WIZ_DIGITAL_SIGN_FILE_NAME_PAGE 0x0200
  1925. #define CRYPTUI_WIZ_DIGITAL_SIGN_CONFIRMATION_PAGE 0x0400
  1926. //-------------------------------------------------------------------------
  1927. //
  1928. // CRYPTUI_WIZ_SIGN_GET_PAGE_INFO
  1929. //
  1930. // dwSize IN Required: should be set to sizeof(CRYPTUI_WIZ_SIGN_GET_PAGE_INFO)
  1931. // dwPageChoice: IN Required: It should one of the following:
  1932. // CRYPTUI_WIZ_DIGITAL_SIGN_ALL_SIGNING_OPTION_PAGES
  1933. // CRYPTUI_WIZ_DIGITAL_SIGN_TYPICAL_SIGNING_OPTION_PAGES
  1934. // CRYPTUI_WIZ_DIGITAL_SIGN_MINIMAL_SIGNING_OPTION_PAGES
  1935. // CRYPTUI_WIZ_DIGITAL_SIGN_CUSTOM_SIGNING_OPTION_PAGES
  1936. // It can also be ORed with any of the following:
  1937. // CRYPTUI_WIZ_DIGITAL_SIGN_WELCOME_PAGE
  1938. // CRYPTUI_WIZ_DIGITAL_SIGN_CONFIRMATION_PAGE
  1939. // CRYPTUI_WIZ_DIGITAL_SIGN_FILE_NAME_PAGE
  1940. // If user tries to sign a BLOB, CRYPTUI_WIZ_DIGITAL_SIGN_FILE_NAME_PAGE
  1941. // should not be set
  1942. // dwFlags; IN Optional: Flags and has to be set to 0
  1943. // hwndParent IN Optional: The parent window of the dialogue
  1944. // pwszPageTitle IN Optional: The title for the pages and the message boxes.
  1945. // pDigitalSignInfo IN Optional: the addtional information for signing
  1946. // pPropPageCallback IN Optional: this callback will be called when each page that is
  1947. // returned in the CryptUIGetViewSignaturesPages call
  1948. // is about to be created or destroyed. if this is NULL no
  1949. // callback is made.
  1950. // pvCallbackData IN Optional: this is uniterpreted data that is passed back when the
  1951. // when pPropPageCallback is made
  1952. // fResult OUT: The result of signing
  1953. // dwError OUT: The value of GetLastError() if fResult is FALSE
  1954. // pSignContext OUT: The context pointer to the signed BLOB. User needs to free
  1955. // the blob by CryptUIWizDigitalSignFreeContext
  1956. // dwReserved Reserved: The private data used by the signing process.
  1957. // must be set to NULL
  1958. // pvSignReserved Reserved: The private data used by the signing process
  1959. // must be set to NULL
  1960. //-------------------------------------------------------------------------
  1961. typedef struct _CRYPTUI_WIZ_GET_SIGN_PAGE_INFO
  1962. {
  1963. DWORD dwSize;
  1964. DWORD dwPageChoice;
  1965. DWORD dwFlags;
  1966. HWND hwndParent;
  1967. LPWSTR pwszPageTitle;
  1968. PCCRYPTUI_WIZ_DIGITAL_SIGN_INFO pDigitalSignInfo;
  1969. PFNCPROPPAGECALLBACK pPropPageCallback;
  1970. void * pvCallbackData;
  1971. BOOL fResult;
  1972. DWORD dwError;
  1973. PCCRYPTUI_WIZ_DIGITAL_SIGN_CONTEXT pSignContext;
  1974. DWORD dwReserved;
  1975. void *pvSignReserved;
  1976. }CRYPTUI_WIZ_GET_SIGN_PAGE_INFO, *PCRYPTUI_WIZ_GET_SIGN_PAGE_INFO;
  1977. typedef const CRYPTUI_WIZ_GET_SIGN_PAGE_INFO *PCCRYPTUI_WIZ_GET_SIGN_PAGE_INFO;
  1978. //-----------------------------------------------------------------------
  1979. //
  1980. // CryptUIWizGetDigitalSignPages
  1981. //
  1982. // Get specific wizard pages from the CryptUIWizDigitalSign wizard.
  1983. // Application can include the pages to other wizards. The pages will
  1984. // gather user inputs throught the new "Parent" wizard.
  1985. // After user clicks the finish buttion, signing process will start the signing
  1986. // and return the result in fResult and dwError field of CRYPTUI_WIZ_SIGN_GET_PAGE_INFO
  1987. // struct. If not enough information can be gathered through the wizard pages,
  1988. // user should supply addtional information in pSignGetPageInfo.
  1989. //
  1990. //
  1991. // pSignGetPageInfo IN Required: The struct that user allocate. It can be used
  1992. // to supply additinal information which is not gathered
  1993. // from the selected wizard pages
  1994. // prghPropPages, OUT Required: The wizard pages returned. Please
  1995. // notice the pszTitle of the struct is set to NULL
  1996. // pcPropPages OUT Required: The number of wizard pages returned
  1997. //------------------------------------------------------------------------
  1998. BOOL
  1999. WINAPI
  2000. CryptUIWizGetDigitalSignPages(
  2001. IN PCRYPTUI_WIZ_GET_SIGN_PAGE_INFO pSignGetPageInfo,
  2002. OUT PROPSHEETPAGEW **prghPropPages,
  2003. OUT DWORD *pcPropPages);
  2004. BOOL
  2005. WINAPI
  2006. CryptUIWizFreeDigitalSignPages(
  2007. IN PROPSHEETPAGEW *rghPropPages,
  2008. IN DWORD cPropPages
  2009. );
  2010. #pragma pack()
  2011. #ifdef __cplusplus
  2012. } // Balance extern "C" above
  2013. #endif
  2014. #endif // _CRYPTUI_H_