1 | /*
|
---|
2 | * Copyright (C) 2008 Juan Lang
|
---|
3 | *
|
---|
4 | * This library is free software; you can redistribute it and/or
|
---|
5 | * modify it under the terms of the GNU Lesser General Public
|
---|
6 | * License as published by the Free Software Foundation; either
|
---|
7 | * version 2.1 of the License, or (at your option) any later version.
|
---|
8 | *
|
---|
9 | * This library is distributed in the hope that it will be useful,
|
---|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
12 | * Lesser General Public License for more details.
|
---|
13 | *
|
---|
14 | * You should have received a copy of the GNU Lesser General Public
|
---|
15 | * License along with this library; if not, write to the Free Software
|
---|
16 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
---|
17 | */
|
---|
18 |
|
---|
19 | /*
|
---|
20 | * Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
|
---|
21 | * other than GPL or LGPL is available it will apply instead, Sun elects to use only
|
---|
22 | * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
|
---|
23 | * a choice of LGPL license versions is made available with the language indicating
|
---|
24 | * that LGPLv2 or any later version may be used, or where a choice of which version
|
---|
25 | * of the LGPL is applied is otherwise unspecified.
|
---|
26 | */
|
---|
27 | #ifndef __CRYPTDLG_H__
|
---|
28 | #define __CRYPTDLG_H__
|
---|
29 |
|
---|
30 | #include <prsht.h>
|
---|
31 |
|
---|
32 | #ifdef __cplusplus
|
---|
33 | extern "C" {
|
---|
34 | #endif
|
---|
35 |
|
---|
36 | #define CRYPTDLG_FLAGS_MASK 0xff000000
|
---|
37 | #define CRYPTDLG_REVOCATION_DEFAULT 0x00000000
|
---|
38 | #define CRYPTDLG_REVOCATION_ONLINE 0x80000000
|
---|
39 | #define CRYPTDLG_REVOCATION_CACHE 0x40000000
|
---|
40 | #define CRYPTDLG_REVOCATION_NONE 0x20000000
|
---|
41 |
|
---|
42 | #define CRYPTDLG_POLICY_MASK 0x0000ffff
|
---|
43 | #define POLICY_IGNORE_NON_CRITICAL_BC 0x00000001
|
---|
44 |
|
---|
45 | #define CRYPTDLG_ACTION_MASK 0xffff0000
|
---|
46 | #define ACTION_REVOCATION_DEFAULT_ONLINE 0x00010000
|
---|
47 | #define ACTION_REVOCATION_DEFAULT_CACHE 0x00020000
|
---|
48 |
|
---|
49 | typedef BOOL (WINAPI *PFNCMFILTERPROC)(PCCERT_CONTEXT, DWORD, DWORD, DWORD);
|
---|
50 |
|
---|
51 | #define CERT_DISPWELL_SELECT 1
|
---|
52 | #define CERT_DISPWELL_TRUST_CA_CERT 2
|
---|
53 | #define CERT_DISPWELL_TRUST_LEAF_CERT 3
|
---|
54 | #define CERT_DISPWELL_TRUST_ADD_CA_CERT 4
|
---|
55 | #define CERT_DISPWELL_TRUST_ADD_LEAF_CERT 5
|
---|
56 | #define CERT_DISPWELL_DISTRUST_CA_CERT 6
|
---|
57 | #define CERT_DISPWELL_DISTRUST_LEAF_CERT 7
|
---|
58 | #define CERT_DISPWELL_DISTRUST_ADD_CA_CERT 8
|
---|
59 | #define CERT_DISPWELL_DISTRUST_ADD_LEAF_CERT 9
|
---|
60 |
|
---|
61 | typedef UINT (WINAPI *PFNCMHOOKPROC)(HWND, UINT, WPARAM, LPARAM);
|
---|
62 |
|
---|
63 | #define CSS_SELECTCERT_MASK 0x00ffffff
|
---|
64 | #define CSS_HIDE_PROPERTIES 0x00000001
|
---|
65 | #define CSS_ENABLEHOOK 0x00000002
|
---|
66 | #define CSS_ALLOWMULTISELECT 0x00000004
|
---|
67 | #define CSS_SHOW_HELP 0x00000010
|
---|
68 | #define CSS_ENABLETEMPLATE 0x00000020
|
---|
69 | #define CSS_ENABLETEMPLATEHANDLE 0x00000040
|
---|
70 |
|
---|
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 |
|
---|
83 | typedef struct tagCSSA
|
---|
84 | {
|
---|
85 | DWORD dwSize;
|
---|
86 | HWND hwndParent;
|
---|
87 | HINSTANCE hInstance;
|
---|
88 | LPCSTR pTemplateName;
|
---|
89 | DWORD dwFlags;
|
---|
90 | LPCSTR szTitle;
|
---|
91 | DWORD cCertStore;
|
---|
92 | HCERTSTORE *arrayCertStore;
|
---|
93 | LPCSTR szPurposeOid;
|
---|
94 | DWORD cCertContext;
|
---|
95 | PCCERT_CONTEXT *arrayCertContext;
|
---|
96 | DWORD lCustData;
|
---|
97 | PFNCMHOOKPROC pfnHook;
|
---|
98 | PFNCMFILTERPROC pfnFilter;
|
---|
99 | LPCSTR szHelpFileName;
|
---|
100 | DWORD dwHelpId;
|
---|
101 | HCRYPTPROV hprov;
|
---|
102 | } CERT_SELECT_STRUCT_A, *PCERT_SELECT_STRUCT_A;
|
---|
103 |
|
---|
104 | typedef struct tagCSSW
|
---|
105 | {
|
---|
106 | DWORD dwSize;
|
---|
107 | HWND hwndParent;
|
---|
108 | HINSTANCE hInstance;
|
---|
109 | LPCWSTR pTemplateName;
|
---|
110 | DWORD dwFlags;
|
---|
111 | LPCWSTR szTitle;
|
---|
112 | DWORD cCertStore;
|
---|
113 | HCERTSTORE *arrayCertStore;
|
---|
114 | LPCSTR szPurposeOid;
|
---|
115 | DWORD cCertContext;
|
---|
116 | PCCERT_CONTEXT *arrayCertContext;
|
---|
117 | DWORD lCustData;
|
---|
118 | PFNCMHOOKPROC pfnHook;
|
---|
119 | PFNCMFILTERPROC pfnFilter;
|
---|
120 | LPCWSTR szHelpFileName;
|
---|
121 | DWORD dwHelpId;
|
---|
122 | HCRYPTPROV hprov;
|
---|
123 | } CERT_SELECT_STRUCT_W, *PCERT_SELECT_STRUCT_W;
|
---|
124 |
|
---|
125 | #define CERT_SELECT_STRUCT WINELIB_NAME_AW(CERT_SELECT_STRUCT_)
|
---|
126 |
|
---|
127 | BOOL WINAPI CertSelectCertificateA(PCERT_SELECT_STRUCT_A pCertSelectInfo);
|
---|
128 | BOOL WINAPI CertSelectCertificateW(PCERT_SELECT_STRUCT_W pCertSelectInfo);
|
---|
129 | #define CertSelectCertificate WINELIB_NAME_AW(CertSelectCertificate)
|
---|
130 |
|
---|
131 | #define CM_VIEWFLAGS_MASK 0x00ffffff
|
---|
132 | #define CM_ENABLEHOOK 0x00000001
|
---|
133 | #define CM_SHOW_HELP 0x00000002
|
---|
134 | #define CM_SHOW_HELPICON 0x00000004
|
---|
135 | #define CM_ENABLETEMPLATE 0x00000008
|
---|
136 | #define CM_HIDE_ADVANCEPAGE 0x00000010
|
---|
137 | #define CM_HIDE_TRUSTPAGE 0x00000020
|
---|
138 | #define CM_NO_NAMECHANGE 0x00000040
|
---|
139 | #define CM_NO_EDITTRUST 0x00000080
|
---|
140 | #define CM_HIDE_DETAILPAGE 0x00000100
|
---|
141 | #define CM_ADD_CERT_STORES 0x00000200
|
---|
142 | #define CERTVIEW_CRYPTUI_LPARAM 0x00800000
|
---|
143 |
|
---|
144 | typedef struct tagCERT_VIEWPROPERTIES_STRUCT_A
|
---|
145 | {
|
---|
146 | DWORD dwSize;
|
---|
147 | HWND hwndParent;
|
---|
148 | HINSTANCE hInstance;
|
---|
149 | DWORD dwFlags;
|
---|
150 | LPCSTR szTitle;
|
---|
151 | PCCERT_CONTEXT pCertContext;
|
---|
152 | LPSTR *arrayPurposes;
|
---|
153 | DWORD cArrayPurposes;
|
---|
154 | DWORD cRootStores;
|
---|
155 | HCERTSTORE *rghstoreRoots;
|
---|
156 | DWORD cStores;
|
---|
157 | HCERTSTORE *rghstoreCAs;
|
---|
158 | DWORD cTrustStores;
|
---|
159 | HCERTSTORE *rghstoreTrust;
|
---|
160 | HCRYPTPROV hprov;
|
---|
161 | DWORD lCustData;
|
---|
162 | DWORD dwPad;
|
---|
163 | LPCSTR szHelpFileName;
|
---|
164 | DWORD dwHelpId;
|
---|
165 | DWORD nStartPage;
|
---|
166 | DWORD cArrayPropSheetPages;
|
---|
167 | /* FIXME: PSDK declares arrayPropSheetPages as a PROPSHEETPAGE *, which we
|
---|
168 | * don't allow in our own headers. It's probably wrong, but we're not
|
---|
169 | * compatible.
|
---|
170 | */
|
---|
171 | PROPSHEETPAGEA *arrayPropSheetPages;
|
---|
172 | } CERT_VIEWPROPERTIES_STRUCT_A, *PCERT_VIEWPROPERTIES_STRUCT_A;
|
---|
173 |
|
---|
174 | typedef struct tagCERT_VIEWPROPERTIES_STRUCT_W
|
---|
175 | {
|
---|
176 | DWORD dwSize;
|
---|
177 | HWND hwndParent;
|
---|
178 | HINSTANCE hInstance;
|
---|
179 | DWORD dwFlags;
|
---|
180 | LPCWSTR szTitle;
|
---|
181 | PCCERT_CONTEXT pCertContext;
|
---|
182 | LPSTR *arrayPurposes;
|
---|
183 | DWORD cArrayPurposes;
|
---|
184 | DWORD cRootStores;
|
---|
185 | HCERTSTORE *rghstoreRoots;
|
---|
186 | DWORD cStores;
|
---|
187 | HCERTSTORE *rghstoreCAs;
|
---|
188 | DWORD cTrustStores;
|
---|
189 | HCERTSTORE *rghstoreTrust;
|
---|
190 | HCRYPTPROV hprov;
|
---|
191 | DWORD lCustData;
|
---|
192 | DWORD dwPad;
|
---|
193 | LPCWSTR szHelpFileName;
|
---|
194 | DWORD dwHelpId;
|
---|
195 | DWORD nStartPage;
|
---|
196 | DWORD cArrayPropSheetPages;
|
---|
197 | /* FIXME: PSDK declares arrayPropSheetPages as a PROPSHEETPAGE *, which we
|
---|
198 | * don't allow in our own headers. It's probably wrong, but we're not
|
---|
199 | * compatible.
|
---|
200 | */
|
---|
201 | PROPSHEETPAGEW *arrayPropSheetPages;
|
---|
202 | } CERT_VIEWPROPERTIES_STRUCT_W, *PCERT_VIEWPROPERTIES_STRUCT_W;
|
---|
203 |
|
---|
204 | #define CERT_VIEWPROPERTIES_STRUCT WINELIB_NAME_AW(CERT_VIEWPROPERTIES_STRUCT_)
|
---|
205 | #define PCERT_VIEWPROPERTIES_STRUCT \
|
---|
206 | WINELIB_NAME_AW(PCERT_VIEWPROPERTIES_STRUCT_)
|
---|
207 |
|
---|
208 | BOOL WINAPI CertViewPropertiesA(PCERT_VIEWPROPERTIES_STRUCT_A pCertViewInfo);
|
---|
209 | BOOL WINAPI CertViewPropertiesW(PCERT_VIEWPROPERTIES_STRUCT_W pCertViewInfo);
|
---|
210 | #define CertViewProperties WINELIB_NAME_AW(CertViewProperties)
|
---|
211 |
|
---|
212 | #define CERT_FILTER_OP_EXISTS 1
|
---|
213 | #define CERT_FILTER_OP_NOT_EXISTS 2
|
---|
214 | #define CERT_FILTER_OP_EQUALITY 3
|
---|
215 |
|
---|
216 | typedef struct tagCMOID
|
---|
217 | {
|
---|
218 | LPCSTR szExtensionOID;
|
---|
219 | DWORD dwTestOperation;
|
---|
220 | LPBYTE pbTestData;
|
---|
221 | DWORD cbTestData;
|
---|
222 | } CERT_FILTER_EXTENSION_MATCH;
|
---|
223 |
|
---|
224 | #define CERT_FILTER_INCLUDE_V1_CERTS 0x0001
|
---|
225 | #define CERT_FILTER_VALID_TIME_RANGE 0x0002
|
---|
226 | #define CERT_FILTER_VALID_SIGNATURE 0x0004
|
---|
227 | #define CERT_FILTER_LEAF_CERTS_ONLY 0x0008
|
---|
228 | #define CERT_FILTER_ISSUER_CERTS_ONLY 0x0010
|
---|
229 | #define CERT_FILTER_KEY_EXISTS 0x0020
|
---|
230 |
|
---|
231 | typedef struct tagCMFLTR
|
---|
232 | {
|
---|
233 | DWORD dwSize;
|
---|
234 | DWORD cExtensionChecks;
|
---|
235 | CERT_FILTER_EXTENSION_MATCH *arrayExtensionChecks;
|
---|
236 | DWORD dwCheckingFlags;
|
---|
237 | } CERT_FILTER_DATA;
|
---|
238 |
|
---|
239 | DWORD WINAPI GetFriendlyNameOfCertA(PCCERT_CONTEXT pccert, LPSTR pchBuffer,
|
---|
240 | DWORD cchBuffer);
|
---|
241 | DWORD WINAPI GetFriendlyNameOfCertW(PCCERT_CONTEXT pccert, LPWSTR pchBuffer,
|
---|
242 | DWORD cchBuffer);
|
---|
243 | #define GetFriendlyNameOfCert WINELIB_NAME_AW(GetFriendlyNameOfCert)
|
---|
244 |
|
---|
245 | #define CERT_CERTIFICATE_ACTION_VERIFY \
|
---|
246 | { 0x7801ebd0, 0xcf4b, 0x11d0, { 0x85,0x1f,0x00,0x60,0x97,0x93,0x87,0xea }}
|
---|
247 | #define szCERT_CERTIFICATE_ACTION_VERIFY \
|
---|
248 | "{7801ebd0-cf4b-11d0-851f-0060979387ea}"
|
---|
249 |
|
---|
250 | typedef HRESULT (WINAPI *PFNTRUSTHELPER)(PCCERT_CONTEXT, DWORD, BOOL, LPBYTE);
|
---|
251 |
|
---|
252 | #define CERT_VALIDITY_MASK_VALIDITY 0x0000ffff
|
---|
253 | #define CERT_VALIDITY_BEFORE_START 0x00000001
|
---|
254 | #define CERT_VALIDITY_AFTER_END 0x00000002
|
---|
255 | #define CERT_VALIDITY_SIGNATURE_FAILS 0x00000004
|
---|
256 | #define CERT_VALIDITY_CERTIFICATE_REVOKED 0x00000008
|
---|
257 | #define CERT_VALIDITY_KEY_USAGE_EXT_FAILURE 0x00000010
|
---|
258 | #define CERT_VALIDITY_EXTENDED_USAGE_FAILURE 0x00000020
|
---|
259 | #define CERT_VALIDITY_NAME_CONSTRAINTS_FAILURE 0x00000040
|
---|
260 | #define CERT_VALIDITY_UNKNOWN_CRITICAL_EXTENSION 0x00000080
|
---|
261 | #define CERT_VALIDITY_ISSUER_INVALID 0x00000100
|
---|
262 | #define CERT_VALIDITY_OTHER_EXTENSION_FAILURE 0x00000200
|
---|
263 | #define CERT_VALIDITY_PERIOD_NESTING_FAILURE 0x00000400
|
---|
264 | #define CERT_VALIDITY_OTHER_ERROR 0x00000800
|
---|
265 |
|
---|
266 | #define CERT_VALIDITY_MASK_TRUST 0xffff0000
|
---|
267 | #define CERT_VALIDITY_EXPLICITLY_DISTRUSTED 0x01000000
|
---|
268 | #define CERT_VALIDITY_ISSUER_DISTRUST 0x02000000
|
---|
269 | #define CERT_VALIDITY_NO_ISSUER_CERT_FOUND 0x10000000
|
---|
270 | #define CERT_VALIDITY_NO_CRL_FOUND 0x20000000
|
---|
271 | #define CERT_VALIDITY_CRL_OUT_OF_DATE 0x40000000
|
---|
272 | #define CERT_VALIDITY_NO_TRUST_DATA 0x80000000
|
---|
273 |
|
---|
274 | #define CERT_TRUST_MASK 0x00ffffff
|
---|
275 | #define CERT_TRUST_DO_FULL_SEARCH 0x00000001
|
---|
276 | #define CERT_TRUST_PERMIT_MISSING_CRLS 0x00000002
|
---|
277 | #define CERT_TRUST_DO_FULL_TRUST 0x00000005
|
---|
278 | #define CERT_TRUST_ADD_CERT_STORES CM_ADD_CERT_STORES
|
---|
279 |
|
---|
280 | typedef struct _CERT_VERIFY_CERTIFICATE_TRUST
|
---|
281 | {
|
---|
282 | DWORD cbSize;
|
---|
283 | PCCERT_CONTEXT pccert;
|
---|
284 | DWORD dwFlags;
|
---|
285 | DWORD dwIgnoreErr;
|
---|
286 | DWORD *pdwErrors;
|
---|
287 | LPSTR pszUsageOid;
|
---|
288 | HCRYPTPROV hprov;
|
---|
289 | DWORD cRootStores;
|
---|
290 | HCERTSTORE *rghstoreRoots;
|
---|
291 | DWORD cStores;
|
---|
292 | HCERTSTORE *rghstoreCAs;
|
---|
293 | DWORD cTrustStores;
|
---|
294 | HCERTSTORE *rghstoreTrust;
|
---|
295 | DWORD lCustData;
|
---|
296 | PFNTRUSTHELPER pfnTrustHelper;
|
---|
297 | DWORD *pcchain;
|
---|
298 | PCCERT_CONTEXT **prgChain;
|
---|
299 | DWORD **prgdwErrors;
|
---|
300 | DATA_BLOB **prgpbTrustInfo;
|
---|
301 | } CERT_VERIFY_CERTIFICATE_TRUST, *PCERT_VERIFY_CERTIFICATE_TRUST;
|
---|
302 |
|
---|
303 | #define CTL_MODIFY_REQUEST_ADD_NOT_TRUSTED 1
|
---|
304 | #define CTL_MODIFY_REQUEST_REMOVE 2
|
---|
305 | #define CTL_MODIFY_REQUEST_ADD_TRUSTED 3
|
---|
306 |
|
---|
307 | typedef struct _CTL_MODIFY_REQUEST
|
---|
308 | {
|
---|
309 | PCCERT_CONTEXT pccert;
|
---|
310 | DWORD dwOperation;
|
---|
311 | DWORD dwError;
|
---|
312 | } CTL_MODIFY_REQUEST, *PCTL_MODIFY_REQUEST;
|
---|
313 |
|
---|
314 | HRESULT WINAPI CertModifyCertificatesToTrust(int cCertStore,
|
---|
315 | PCTL_MODIFY_REQUEST rgCerts, LPCSTR szPurpose, HWND hwnd,
|
---|
316 | HCERTSTORE hcertstoreTrust);
|
---|
317 |
|
---|
318 | #ifdef __cplusplus
|
---|
319 | }
|
---|
320 | #endif
|
---|
321 |
|
---|
322 | #endif
|
---|