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.

627 lines
22 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1997.
  5. //
  6. // File: cryptdlg.h
  7. //
  8. // Contents: Common Cryptographic Dialog API Prototypes and Definitions
  9. //
  10. //----------------------------------------------------------------------------
  11. #ifndef __CRYPTDLG_H__
  12. #define __CRYPTDLG_H__
  13. #if defined (_MSC_VER) && (_MSC_VER >= 1020)
  14. #pragma once
  15. #endif
  16. #ifdef _CRYPTDLG_
  17. #define CRYPTDLGAPI
  18. #else
  19. #define CRYPTDLGAPI DECLSPEC_IMPORT
  20. #endif
  21. #if (_WIN32_WINNT >= 0x0400) || defined(_MAC) || defined(WIN16)
  22. #include <prsht.h>
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. // Master flags to control how revocation is managed
  27. #define CRYTPDLG_FLAGS_MASK 0xff000000
  28. #define CRYPTDLG_REVOCATION_DEFAULT 0x00000000
  29. #define CRYPTDLG_REVOCATION_ONLINE 0x80000000
  30. #define CRYPTDLG_REVOCATION_CACHE 0x40000000
  31. #define CRYPTDLG_REVOCATION_NONE 0x20000000
  32. // Policy flags which control how we deal with user's certificates
  33. #define CRYPTDLG_POLICY_MASK 0x0000FFFF
  34. #define POLICY_IGNORE_NON_CRITICAL_BC 0x00000001
  35. #define CRYPTDLG_ACTION_MASK 0xFFFF0000
  36. #define ACTION_REVOCATION_DEFAULT_ONLINE 0x00010000
  37. #define ACTION_REVOCATION_DEFAULT_CACHE 0x00020000
  38. //
  39. // Many of the common dialogs can be passed a filter proc to reduce
  40. // the set of certificates displayed. A generic filter proc has been
  41. // provided to cover many of the generic cases.
  42. // Return TRUE to display and FALSE to hide
  43. typedef BOOL (WINAPI * PFNCMFILTERPROC)(
  44. IN PCCERT_CONTEXT pCertContext,
  45. IN DWORD, // lCustData, a cookie
  46. IN DWORD, // dwFlags
  47. IN DWORD); // dwDisplayWell
  48. // Display Well Values
  49. #define CERT_DISPWELL_SELECT 1
  50. #define CERT_DISPWELL_TRUST_CA_CERT 2
  51. #define CERT_DISPWELL_TRUST_LEAF_CERT 3
  52. #define CERT_DISPWELL_TRUST_ADD_CA_CERT 4
  53. #define CERT_DISPWELL_TRUST_ADD_LEAF_CERT 5
  54. #define CERT_DISPWELL_DISTRUST_CA_CERT 6
  55. #define CERT_DISPWELL_DISTRUST_LEAF_CERT 7
  56. #define CERT_DISPWELL_DISTRUST_ADD_CA_CERT 8
  57. #define CERT_DISPWELL_DISTRUST_ADD_LEAF_CERT 9
  58. //
  59. typedef UINT (WINAPI * PFNCMHOOKPROC)(
  60. IN HWND hwndDialog,
  61. IN UINT message,
  62. IN WPARAM wParam,
  63. IN LPARAM lParam);
  64. //
  65. #define CSS_HIDE_PROPERTIES 0x00000001
  66. #define CSS_ENABLEHOOK 0x00000002
  67. #define CSS_ALLOWMULTISELECT 0x00000004
  68. #define CSS_SHOW_HELP 0x00000010
  69. #define CSS_ENABLETEMPLATE 0x00000020
  70. #define CSS_ENABLETEMPLATEHANDLE 0x00000040
  71. #define SELCERT_OK IDOK
  72. #define SELCERT_CANCEL IDCANCEL
  73. #define SELCERT_PROPERTIES 100
  74. #define SELCERT_FINEPRINT 101
  75. #define SELCERT_CERTLIST 102
  76. #define SELCERT_HELP IDHELP
  77. #define SELCERT_ISSUED_TO 103
  78. #define SELCERT_VALIDITY 104
  79. #define SELCERT_ALGORITHM 105
  80. #define SELCERT_SERIAL_NUM 106
  81. #define SELCERT_THUMBPRINT 107
  82. typedef struct tagCSSA {
  83. DWORD dwSize;
  84. HWND hwndParent;
  85. HINSTANCE hInstance;
  86. LPCSTR pTemplateName;
  87. DWORD dwFlags;
  88. LPCSTR szTitle;
  89. DWORD cCertStore;
  90. HCERTSTORE * arrayCertStore;
  91. LPCSTR szPurposeOid;
  92. DWORD cCertContext;
  93. PCCERT_CONTEXT * arrayCertContext;
  94. DWORD lCustData;
  95. PFNCMHOOKPROC pfnHook;
  96. PFNCMFILTERPROC pfnFilter;
  97. LPCSTR szHelpFileName;
  98. DWORD dwHelpId;
  99. HCRYPTPROV hprov;
  100. } CERT_SELECT_STRUCT_A, *PCERT_SELECT_STRUCT_A;
  101. typedef struct tagCSSW {
  102. DWORD dwSize;
  103. HWND hwndParent;
  104. HINSTANCE hInstance;
  105. LPCWSTR pTemplateName;
  106. DWORD dwFlags;
  107. LPCWSTR szTitle;
  108. DWORD cCertStore;
  109. HCERTSTORE * arrayCertStore;
  110. LPCSTR szPurposeOid;
  111. DWORD cCertContext;
  112. PCCERT_CONTEXT * arrayCertContext;
  113. DWORD lCustData;
  114. PFNCMHOOKPROC pfnHook;
  115. PFNCMFILTERPROC pfnFilter;
  116. LPCWSTR szHelpFileName;
  117. DWORD dwHelpId;
  118. HCRYPTPROV hprov;
  119. } CERT_SELECT_STRUCT_W, *PCERT_SELECT_STRUCT_W;
  120. #ifdef UNICODE
  121. typedef CERT_SELECT_STRUCT_W CERT_SELECT_STRUCT;
  122. typedef PCERT_SELECT_STRUCT_W PCERT_SELECT_STRUCT;
  123. #else
  124. typedef CERT_SELECT_STRUCT_A CERT_SELECT_STRUCT;
  125. typedef PCERT_SELECT_STRUCT_A PCERT_SELECT_STRUCT;
  126. #endif // UNICODE
  127. CRYPTDLGAPI
  128. BOOL
  129. WINAPI
  130. CertSelectCertificateA(
  131. IN OUT PCERT_SELECT_STRUCT_A pCertSelectInfo
  132. );
  133. #ifdef MAC
  134. #define CertSelectCertificate CertSelectCertificateA
  135. #else // !MAC
  136. CRYPTDLGAPI
  137. BOOL
  138. WINAPI
  139. CertSelectCertificateW(
  140. IN OUT PCERT_SELECT_STRUCT_W pCertSelectInfo
  141. );
  142. #ifdef UNICODE
  143. #define CertSelectCertificate CertSelectCertificateW
  144. #else
  145. #define CertSelectCertificate CertSelectCertificateA
  146. #endif
  147. #endif // MAC
  148. typedef struct tagCSSA_CUI {
  149. DWORD dwSize;
  150. HWND hwndParent;
  151. HINSTANCE hInstance;
  152. LPCSTR pTemplateName;
  153. DWORD dwFlags;
  154. LPCSTR szTitle;
  155. DWORD cCertStore;
  156. HCERTSTORE * arrayCertStore;
  157. LPCSTR szPurposeOid;
  158. DWORD cCertContext;
  159. PCCERT_CONTEXT * arrayCertContext;
  160. DWORD lCustData;
  161. PFNCMHOOKPROC pfnHook;
  162. PFNCMFILTERPROC pfnFilter;
  163. LPCSTR szHelpFileName;
  164. DWORD dwHelpId;
  165. HCRYPTPROV hprov;
  166. } CERT_SELECT_CRYPTUI_STRUCT_A, *PCERT_SELECT_CRYPTUI_STRUCT_A;
  167. typedef struct tagCSSW_CUI {
  168. DWORD dwSize;
  169. HWND hwndParent;
  170. HINSTANCE hInstance;
  171. LPCWSTR pTemplateName;
  172. DWORD dwFlags;
  173. LPCWSTR szTitle;
  174. DWORD cCertStore;
  175. HCERTSTORE * arrayCertStore;
  176. LPCSTR szPurposeOid;
  177. DWORD cCertContext;
  178. PCCERT_CONTEXT * arrayCertContext;
  179. DWORD lCustData;
  180. PFNCMHOOKPROC pfnHook;
  181. PFNCMFILTERPROC pfnFilter;
  182. LPCWSTR szHelpFileName;
  183. DWORD dwHelpId;
  184. HCRYPTPROV hprov;
  185. } CERT_SELECT_CRYPTUI_STRUCT_W, *PCERT_SELECT_CRYPTUI_STRUCT_W;
  186. #ifdef UNICODE
  187. typedef CERT_SELECT_CRYPTUI_STRUCT_W CERT_SELECT_CRYPTUI_STRUCT;
  188. typedef PCERT_SELECT_CRYPTUI_STRUCT_W PCERT_SELECT_CRYPTUI_STRUCT;
  189. #else
  190. typedef CERT_SELECT_CRYPTUI_STRUCT_A CERT_SELECT_CRYPTUI_STRUCT;
  191. typedef PCERT_SELECT_CRYPTUI_STRUCT_A PCERT_SELECT_CRYPTUI_STRUCT;
  192. #endif // UNICODE
  193. CRYPTDLGAPI
  194. BOOL
  195. WINAPI
  196. CertSelectCertificateCryptUIA(
  197. IN OUT PCERT_SELECT_CRYPTUI_STRUCT_A pCertSelectInfo
  198. );
  199. #ifdef MAC
  200. #define CertSelectCertificateCryptUI CertSelectCertificateCryptUIA
  201. #else // !MAC
  202. CRYPTDLGAPI
  203. BOOL
  204. WINAPI
  205. CertSelectCertificateCryptUIW(
  206. IN OUT PCERT_SELECT_CRYPTUI_STRUCT_W pCertSelectInfo
  207. );
  208. #ifdef UNICODE
  209. #define CertSelectCertificateCryptUI CertSelectCertificateCryptUIW
  210. #else
  211. #define CertSelectCertificateCryptUI CertSelectCertificateCryptUIA
  212. #endif
  213. #endif // MAC
  214. /////////////////////////////////////////////////////////////
  215. #define CM_VIEWFLAGS_MASK 0x00ffffff
  216. #define CM_ENABLEHOOK 0x00000001
  217. #define CM_SHOW_HELP 0x00000002
  218. #define CM_SHOW_HELPICON 0x00000004
  219. #define CM_ENABLETEMPLATE 0x00000008
  220. #define CM_HIDE_ADVANCEPAGE 0x00000010
  221. #define CM_HIDE_TRUSTPAGE 0x00000020
  222. #define CM_NO_NAMECHANGE 0x00000040
  223. #define CM_NO_EDITTRUST 0x00000080
  224. #define CM_HIDE_DETAILPAGE 0x00000100
  225. #define CM_ADD_CERT_STORES 0x00000200
  226. #define CERTVIEW_CRYPTUI_LPARAM 0x00800000
  227. typedef struct tagCERT_VIEWPROPERTIES_STRUCT_A {
  228. DWORD dwSize;
  229. HWND hwndParent;
  230. HINSTANCE hInstance;
  231. DWORD dwFlags;
  232. LPCSTR szTitle;
  233. PCCERT_CONTEXT pCertContext;
  234. LPSTR * arrayPurposes;
  235. DWORD cArrayPurposes;
  236. DWORD cRootStores; // Count of Root Stores
  237. HCERTSTORE * rghstoreRoots; // Array of root stores
  238. DWORD cStores; // Count of other stores to search
  239. HCERTSTORE * rghstoreCAs; // Array of other stores to search
  240. DWORD cTrustStores; // Count of trust stores
  241. HCERTSTORE * rghstoreTrust; // Array of trust stores
  242. HCRYPTPROV hprov; // Provider to use for verification
  243. DWORD lCustData;
  244. DWORD dwPad;
  245. LPCSTR szHelpFileName;
  246. DWORD dwHelpId;
  247. DWORD nStartPage;
  248. DWORD cArrayPropSheetPages;
  249. PROPSHEETPAGE * arrayPropSheetPages;
  250. } CERT_VIEWPROPERTIES_STRUCT_A, *PCERT_VIEWPROPERTIES_STRUCT_A;
  251. typedef struct tagCERT_VIEWPROPERTIES_STRUCT_W {
  252. DWORD dwSize;
  253. HWND hwndParent;
  254. HINSTANCE hInstance;
  255. DWORD dwFlags;
  256. LPCWSTR szTitle;
  257. PCCERT_CONTEXT pCertContext;
  258. LPSTR * arrayPurposes;
  259. DWORD cArrayPurposes;
  260. DWORD cRootStores; // Count of Root Stores
  261. HCERTSTORE * rghstoreRoots; // Array of root stores
  262. DWORD cStores; // Count of other stores to search
  263. HCERTSTORE * rghstoreCAs; // Array of other stores to search
  264. DWORD cTrustStores; // Count of trust stores
  265. HCERTSTORE * rghstoreTrust; // Array of trust stores
  266. HCRYPTPROV hprov; // Provider to use for verification
  267. DWORD lCustData;
  268. DWORD dwPad;
  269. LPCWSTR szHelpFileName;
  270. DWORD dwHelpId;
  271. DWORD nStartPage;
  272. DWORD cArrayPropSheetPages;
  273. PROPSHEETPAGE * arrayPropSheetPages;
  274. } CERT_VIEWPROPERTIES_STRUCT_W, *PCERT_VIEWPROPERTIES_STRUCT_W;
  275. #ifdef UNICODE
  276. typedef CERT_VIEWPROPERTIES_STRUCT_W CERT_VIEWPROPERTIES_STRUCT;
  277. typedef PCERT_VIEWPROPERTIES_STRUCT_W PCERT_VIEWPROPERTIES_STRUCT;
  278. #else
  279. typedef CERT_VIEWPROPERTIES_STRUCT_A CERT_VIEWPROPERTIES_STRUCT;
  280. typedef PCERT_VIEWPROPERTIES_STRUCT_A PCERT_VIEWPROPERTIES_STRUCT;
  281. #endif // UNICODE
  282. CRYPTDLGAPI
  283. BOOL
  284. WINAPI
  285. CertViewPropertiesA(
  286. PCERT_VIEWPROPERTIES_STRUCT_A pCertViewInfo
  287. );
  288. #ifdef MAC
  289. #define CertViewProperties CertViewPropertiesA
  290. #else // !MAC
  291. CRYPTDLGAPI
  292. BOOL
  293. WINAPI
  294. CertViewPropertiesW(
  295. PCERT_VIEWPROPERTIES_STRUCT_W pCertViewInfo
  296. );
  297. #ifdef UNICODE
  298. #define CertViewProperties CertViewPropertiesW
  299. #else
  300. #define CertViewProperties CertViewPropertiesA
  301. #endif
  302. #endif // MAC
  303. typedef struct tagCERT_VIEWPROPERTIESCRYPTUI_STRUCT_A {
  304. DWORD dwSize;
  305. HWND hwndParent;
  306. HINSTANCE hInstance;
  307. DWORD dwFlags;
  308. LPCSTR szTitle;
  309. PCCERT_CONTEXT pCertContext;
  310. LPSTR * arrayPurposes;
  311. DWORD cArrayPurposes;
  312. DWORD cRootStores; // Count of Root Stores
  313. HCERTSTORE * rghstoreRoots; // Array of root stores
  314. DWORD cStores; // Count of other stores to search
  315. HCERTSTORE * rghstoreCAs; // Array of other stores to search
  316. DWORD cTrustStores; // Count of trust stores
  317. HCERTSTORE * rghstoreTrust; // Array of trust stores
  318. HCRYPTPROV hprov; // Provider to use for verification
  319. DWORD lCustData;
  320. DWORD dwPad;
  321. LPCSTR szHelpFileName;
  322. DWORD dwHelpId;
  323. DWORD nStartPage;
  324. DWORD cArrayPropSheetPages;
  325. PROPSHEETPAGE * arrayPropSheetPages;
  326. } CERT_VIEWPROPERTIESCRYPTUI_STRUCT_A, *PCERT_VIEWPROPERTIESCRYPTUI_STRUCT_A;
  327. typedef struct tagCERT_VIEWPROPERTIESCRYPTUI_STRUCT_W {
  328. DWORD dwSize;
  329. HWND hwndParent;
  330. HINSTANCE hInstance;
  331. DWORD dwFlags;
  332. LPCWSTR szTitle;
  333. PCCERT_CONTEXT pCertContext;
  334. LPSTR * arrayPurposes;
  335. DWORD cArrayPurposes;
  336. DWORD cRootStores; // Count of Root Stores
  337. HCERTSTORE * rghstoreRoots; // Array of root stores
  338. DWORD cStores; // Count of other stores to search
  339. HCERTSTORE * rghstoreCAs; // Array of other stores to search
  340. DWORD cTrustStores; // Count of trust stores
  341. HCERTSTORE * rghstoreTrust; // Array of trust stores
  342. HCRYPTPROV hprov; // Provider to use for verification
  343. DWORD lCustData;
  344. DWORD dwPad;
  345. LPCWSTR szHelpFileName;
  346. DWORD dwHelpId;
  347. DWORD nStartPage;
  348. DWORD cArrayPropSheetPages;
  349. PROPSHEETPAGE * arrayPropSheetPages;
  350. } CERT_VIEWPROPERTIESCRYPTUI_STRUCT_W, *PCERT_VIEWPROPERTIESCRYPTUI_STRUCT_W;
  351. #ifdef UNICODE
  352. typedef CERT_VIEWPROPERTIESCRYPTUI_STRUCT_W CERT_VIEWPROPERTIESCRYPTUI_STRUCT;
  353. typedef PCERT_VIEWPROPERTIESCRYPTUI_STRUCT_W PCERT_VIEWPROPERTIESCRYPTUI_STRUCT;
  354. #else
  355. typedef CERT_VIEWPROPERTIESCRYPTUI_STRUCT_A CERT_VIEWPROPERTIESCRYPTUI_STRUCT;
  356. typedef PCERT_VIEWPROPERTIESCRYPTUI_STRUCT_A PCERT_VIEWPROPERTIESCRYPTUI_STRUCT;
  357. #endif // UNICODE
  358. CRYPTDLGAPI
  359. BOOL
  360. WINAPI
  361. CertViewPropertiesCryptUIA(
  362. PCERT_VIEWPROPERTIESCRYPTUI_STRUCT_A pCertViewInfo
  363. );
  364. #ifdef MAC
  365. #define CertViewPropertiesCryptUI CertViewPropertiesCryptUIA
  366. #else // !MAC
  367. CRYPTDLGAPI
  368. BOOL
  369. WINAPI
  370. CertViewPropertiesCryptUIW(
  371. PCERT_VIEWPROPERTIESCRYPTUI_STRUCT_W pCertViewInfo
  372. );
  373. #ifdef UNICODE
  374. #define CertViewPropertiesCryptUI CertViewPropertiesCryptUIW
  375. #else
  376. #define CertViewPropertiesCryptUI CertViewPropertiesCryptUIA
  377. #endif
  378. #endif // MAC
  379. //
  380. // We provide a default filter function that people can use to do some
  381. // of the most simple things.
  382. //
  383. #define CERT_FILTER_OP_EXISTS 1
  384. #define CERT_FILTER_OP_NOT_EXISTS 2
  385. #define CERT_FILTER_OP_EQUALITY 3
  386. typedef struct tagCMOID {
  387. LPCSTR szExtensionOID; // Extension to filter on
  388. DWORD dwTestOperation;
  389. LPBYTE pbTestData;
  390. DWORD cbTestData;
  391. } CERT_FILTER_EXTENSION_MATCH;
  392. #define CERT_FILTER_INCLUDE_V1_CERTS 0x0001
  393. #define CERT_FILTER_VALID_TIME_RANGE 0x0002
  394. #define CERT_FILTER_VALID_SIGNATURE 0x0004
  395. #define CERT_FILTER_LEAF_CERTS_ONLY 0x0008
  396. #define CERT_FILTER_ISSUER_CERTS_ONLY 0x0010
  397. #define CERT_FILTER_KEY_EXISTS 0x0020
  398. typedef struct tagCMFLTR {
  399. DWORD dwSize;
  400. DWORD cExtensionChecks;
  401. CERT_FILTER_EXTENSION_MATCH * arrayExtensionChecks;
  402. DWORD dwCheckingFlags;
  403. } CERT_FILTER_DATA;
  404. //
  405. // Maybe this should not be here -- but until it goes into wincrypt.h
  406. //
  407. //
  408. // Get a formatted friendly name for a certificate
  409. CRYPTDLGAPI
  410. DWORD
  411. WINAPI
  412. GetFriendlyNameOfCertA(PCCERT_CONTEXT pccert, LPSTR pchBuffer,
  413. DWORD cchBuffer);
  414. CRYPTDLGAPI
  415. DWORD
  416. WINAPI
  417. GetFriendlyNameOfCertW(PCCERT_CONTEXT pccert, LPWSTR pchBuffer,
  418. DWORD cchBuffer);
  419. #ifdef UNICODE
  420. #define GetFriendlyNameOfCert GetFriendlyNameOfCertW
  421. #else
  422. #define GetFriendlyNameOfCert GetFriendlyNameOfCertA
  423. #endif
  424. //
  425. // We also provide a WinTrust provider which performs the same set of
  426. // parameter checking that we do in order to validate certificates.
  427. //
  428. #define CERT_CERTIFICATE_ACTION_VERIFY \
  429. { /* 7801ebd0-cf4b-11d0-851f-0060979387ea */ \
  430. 0x7801ebd0, \
  431. 0xcf4b, \
  432. 0x11d0, \
  433. {0x85, 0x1f, 0x00, 0x60, 0x97, 0x93, 0x87, 0xea} \
  434. }
  435. #define szCERT_CERTIFICATE_ACTION_VERIFY \
  436. "{7801ebd0-cf4b-11d0-851f-0060979387ea}"
  437. typedef HRESULT (WINAPI * PFNTRUSTHELPER)(
  438. IN PCCERT_CONTEXT pCertContext,
  439. IN DWORD lCustData,
  440. IN BOOL fLeafCertificate,
  441. IN LPBYTE pbTrustBlob);
  442. //
  443. // Failure Reasons:
  444. //
  445. #define CERT_VALIDITY_BEFORE_START 0x00000001
  446. #define CERT_VALIDITY_AFTER_END 0x00000002
  447. #define CERT_VALIDITY_SIGNATURE_FAILS 0x00000004
  448. #define CERT_VALIDITY_CERTIFICATE_REVOKED 0x00000008
  449. #define CERT_VALIDITY_KEY_USAGE_EXT_FAILURE 0x00000010
  450. #define CERT_VALIDITY_EXTENDED_USAGE_FAILURE 0x00000020
  451. #define CERT_VALIDITY_NAME_CONSTRAINTS_FAILURE 0x00000040
  452. #define CERT_VALIDITY_UNKNOWN_CRITICAL_EXTENSION 0x00000080
  453. #define CERT_VALIDITY_ISSUER_INVALID 0x00000100
  454. #define CERT_VALIDITY_OTHER_EXTENSION_FAILURE 0x00000200
  455. #define CERT_VALIDITY_PERIOD_NESTING_FAILURE 0x00000400
  456. #define CERT_VALIDITY_OTHER_ERROR 0x00000800
  457. #define CERT_VALIDITY_ISSUER_DISTRUST 0x02000000
  458. #define CERT_VALIDITY_EXPLICITLY_DISTRUSTED 0x01000000
  459. #define CERT_VALIDITY_NO_ISSUER_CERT_FOUND 0x10000000
  460. #define CERT_VALIDITY_NO_CRL_FOUND 0x20000000
  461. #define CERT_VALIDITY_CRL_OUT_OF_DATE 0x40000000
  462. #define CERT_VALIDITY_NO_TRUST_DATA 0x80000000
  463. #define CERT_VALIDITY_MASK_TRUST 0xffff0000
  464. #define CERT_VALIDITY_MASK_VALIDITY 0x0000ffff
  465. #define CERT_TRUST_DO_FULL_SEARCH 0x00000001
  466. #define CERT_TRUST_PERMIT_MISSING_CRLS 0x00000002
  467. #define CERT_TRUST_DO_FULL_TRUST 0x00000005
  468. #define CERT_TRUST_ADD_CERT_STORES CM_ADD_CERT_STORES
  469. //
  470. // Trust data structure
  471. //
  472. // Returned data arrays will be allocated using LocalAlloc and must
  473. // be freed by the caller. The data in the TrustInfo array are individually
  474. // allocated and must be freed. The data in rgChain must be freed by
  475. // calling CertFreeCertificateContext.
  476. //
  477. // Defaults:
  478. // pszUsageOid == NULL indicates that no trust validation should be done
  479. // cRootStores == 0 Will default to User's Root store
  480. // cStores == 0 Will default to User's CA and system's SPC stores
  481. // cTrustStores == 0 Will default to User's TRUST store
  482. // hprov == NULL Will default to RSABase
  483. // any returned item which has a null pointer will not return that item.
  484. // Notes:
  485. // pfnTrustHelper is nyi
  486. typedef struct _CERT_VERIFY_CERTIFICATE_TRUST {
  487. DWORD cbSize; // Size of this structure
  488. PCCERT_CONTEXT pccert; // Certificate to be verified
  489. DWORD dwFlags; // CERT_TRUST_*
  490. DWORD dwIgnoreErr; // Errors to ignore (CERT_VALIDITY_*)
  491. DWORD * pdwErrors; // Location to return error flags
  492. LPSTR pszUsageOid; // Extended Usage OID for Certificate
  493. HCRYPTPROV hprov; // Crypt Provider to use for validation
  494. DWORD cRootStores; // Count of Root Stores
  495. HCERTSTORE * rghstoreRoots; // Array of root stores
  496. DWORD cStores; // Count of other stores to search
  497. HCERTSTORE * rghstoreCAs; // Array of other stores to search
  498. DWORD cTrustStores; // Count of trust stores
  499. HCERTSTORE * rghstoreTrust; // Array of trust stores
  500. DWORD lCustData; //
  501. PFNTRUSTHELPER pfnTrustHelper; // Callback function for cert validation
  502. DWORD * pcChain; // Count of items in the chain array
  503. PCCERT_CONTEXT ** prgChain; // Chain of certificates used
  504. DWORD ** prgdwErrors; // Errors on a per certificate basis
  505. DATA_BLOB ** prgpbTrustInfo; // Array of trust information used
  506. } CERT_VERIFY_CERTIFICATE_TRUST, * PCERT_VERIFY_CERTIFICATE_TRUST;
  507. //
  508. // Trust list manipulation routine
  509. //
  510. // CertModifyCertificatesToTrust can be used to do modifications to the set of certificates
  511. // on trust lists for a given purpose.
  512. // if hcertstoreTrust is NULL, the System Store TRUST in Current User will be used
  513. // if pccertSigner is specified, it will be used to sign the resulting trust lists,
  514. // it also restricts the set of trust lists that may be modified.
  515. //
  516. #define CTL_MODIFY_REQUEST_ADD_NOT_TRUSTED 1
  517. #define CTL_MODIFY_REQUEST_REMOVE 2
  518. #define CTL_MODIFY_REQUEST_ADD_TRUSTED 3
  519. typedef struct _CTL_MODIFY_REQUEST {
  520. PCCERT_CONTEXT pccert; // Certificate to change trust on
  521. DWORD dwOperation; // Operation to be performed
  522. DWORD dwError; // Operation error code
  523. } CTL_MODIFY_REQUEST, * PCTL_MODIFY_REQUEST;
  524. CRYPTDLGAPI
  525. HRESULT
  526. WINAPI
  527. CertModifyCertificatesToTrust(
  528. int cCerts, // Count of modifications to be done
  529. PCTL_MODIFY_REQUEST rgCerts, // Array of modification requests
  530. LPCSTR szPurpose, // Purpose OID to for modifications
  531. HWND hwnd, // HWND for any dialogs
  532. HCERTSTORE hcertstoreTrust, // Cert Store to store trust information in
  533. PCCERT_CONTEXT pccertSigner); // Certificate to be used in signing trust list
  534. #ifdef WIN16
  535. // Need to define export functions in WATCOM.
  536. BOOL
  537. WINAPI CertConfigureTrustA(void);
  538. BOOL
  539. WINAPI FormatVerisignExtension(
  540. DWORD /*dwCertEncodingType*/,
  541. DWORD /*dwFormatType*/,
  542. DWORD /*dwFormatStrType*/,
  543. void * /*pFormatStruct*/,
  544. LPCSTR /*lpszStructType*/,
  545. const BYTE * /*pbEncoded*/,
  546. DWORD /*cbEncoded*/,
  547. void * pbFormat,
  548. DWORD * pcbFormat);
  549. #endif // !WIN16
  550. #define malloc(_cb) GlobalAlloc(GMEM_FIXED, _cb)
  551. #define realloc(_pb, _cb) GlobalReAlloc(_pb, _cb, 0)
  552. #define free(_pb) GlobalFree(_pb)
  553. #ifdef __cplusplus
  554. } // Balance extern "C" above
  555. #endif
  556. #endif // (_WIN32_WINNT >= 0x0400)
  557. #endif // _CRYPTDLG_H_