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 | * Oracle 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, Oracle 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 |
|
---|
28 | #ifndef __CRYPTDLG_H__
|
---|
29 | #define __CRYPTDLG_H__
|
---|
30 |
|
---|
31 | #include <prsht.h>
|
---|
32 |
|
---|
33 | #ifdef __cplusplus
|
---|
34 | extern "C" {
|
---|
35 | #endif
|
---|
36 |
|
---|
37 | #define CRYPTDLG_FLAGS_MASK 0xff000000
|
---|
38 | #define CRYPTDLG_REVOCATION_DEFAULT 0x00000000
|
---|
39 | #define CRYPTDLG_REVOCATION_ONLINE 0x80000000
|
---|
40 | #define CRYPTDLG_REVOCATION_CACHE 0x40000000
|
---|
41 | #define CRYPTDLG_REVOCATION_NONE 0x20000000
|
---|
42 |
|
---|
43 | #define CRYPTDLG_POLICY_MASK 0x0000ffff
|
---|
44 | #define POLICY_IGNORE_NON_CRITICAL_BC 0x00000001
|
---|
45 |
|
---|
46 | #define CRYPTDLG_ACTION_MASK 0xffff0000
|
---|
47 | #define ACTION_REVOCATION_DEFAULT_ONLINE 0x00010000
|
---|
48 | #define ACTION_REVOCATION_DEFAULT_CACHE 0x00020000
|
---|
49 |
|
---|
50 | typedef BOOL (WINAPI *PFNCMFILTERPROC)(PCCERT_CONTEXT, DWORD, DWORD, DWORD);
|
---|
51 |
|
---|
52 | #define CERT_DISPWELL_SELECT 1
|
---|
53 | #define CERT_DISPWELL_TRUST_CA_CERT 2
|
---|
54 | #define CERT_DISPWELL_TRUST_LEAF_CERT 3
|
---|
55 | #define CERT_DISPWELL_TRUST_ADD_CA_CERT 4
|
---|
56 | #define CERT_DISPWELL_TRUST_ADD_LEAF_CERT 5
|
---|
57 | #define CERT_DISPWELL_DISTRUST_CA_CERT 6
|
---|
58 | #define CERT_DISPWELL_DISTRUST_LEAF_CERT 7
|
---|
59 | #define CERT_DISPWELL_DISTRUST_ADD_CA_CERT 8
|
---|
60 | #define CERT_DISPWELL_DISTRUST_ADD_LEAF_CERT 9
|
---|
61 |
|
---|
62 | typedef UINT (WINAPI *PFNCMHOOKPROC)(HWND, UINT, WPARAM, LPARAM);
|
---|
63 |
|
---|
64 | #define CSS_SELECTCERT_MASK 0x00ffffff
|
---|
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 |
|
---|
72 | #define SELCERT_OK IDOK
|
---|
73 | #define SELCERT_CANCEL IDCANCEL
|
---|
74 | #define SELCERT_PROPERTIES 100
|
---|
75 | #define SELCERT_FINEPRINT 101
|
---|
76 | #define SELCERT_CERTLIST 102
|
---|
77 | #define SELCERT_HELP IDHELP
|
---|
78 | #define SELCERT_ISSUED_TO 103
|
---|
79 | #define SELCERT_VALIDITY 104
|
---|
80 | #define SELCERT_ALGORITHM 105
|
---|
81 | #define SELCERT_SERIAL_NUM 106
|
---|
82 | #define SELCERT_THUMBPRINT 107
|
---|
83 |
|
---|
84 | typedef struct tagCSSA
|
---|
85 | {
|
---|
86 | DWORD dwSize;
|
---|
87 | HWND hwndParent;
|
---|
88 | HINSTANCE hInstance;
|
---|
89 | LPCSTR pTemplateName;
|
---|
90 | DWORD dwFlags;
|
---|
91 | LPCSTR szTitle;
|
---|
92 | DWORD cCertStore;
|
---|
93 | HCERTSTORE *arrayCertStore;
|
---|
94 | LPCSTR szPurposeOid;
|
---|
95 | DWORD cCertContext;
|
---|
96 | PCCERT_CONTEXT *arrayCertContext;
|
---|
97 | DWORD lCustData;
|
---|
98 | PFNCMHOOKPROC pfnHook;
|
---|
99 | PFNCMFILTERPROC pfnFilter;
|
---|
100 | LPCSTR szHelpFileName;
|
---|
101 | DWORD dwHelpId;
|
---|
102 | HCRYPTPROV hprov;
|
---|
103 | } CERT_SELECT_STRUCT_A, *PCERT_SELECT_STRUCT_A;
|
---|
104 |
|
---|
105 | typedef struct tagCSSW
|
---|
106 | {
|
---|
107 | DWORD dwSize;
|
---|
108 | HWND hwndParent;
|
---|
109 | HINSTANCE hInstance;
|
---|
110 | LPCWSTR pTemplateName;
|
---|
111 | DWORD dwFlags;
|
---|
112 | LPCWSTR szTitle;
|
---|
113 | DWORD cCertStore;
|
---|
114 | HCERTSTORE *arrayCertStore;
|
---|
115 | LPCSTR szPurposeOid;
|
---|
116 | DWORD cCertContext;
|
---|
117 | PCCERT_CONTEXT *arrayCertContext;
|
---|
118 | DWORD lCustData;
|
---|
119 | PFNCMHOOKPROC pfnHook;
|
---|
120 | PFNCMFILTERPROC pfnFilter;
|
---|
121 | LPCWSTR szHelpFileName;
|
---|
122 | DWORD dwHelpId;
|
---|
123 | HCRYPTPROV hprov;
|
---|
124 | } CERT_SELECT_STRUCT_W, *PCERT_SELECT_STRUCT_W;
|
---|
125 |
|
---|
126 | #define CERT_SELECT_STRUCT WINELIB_NAME_AW(CERT_SELECT_STRUCT_)
|
---|
127 |
|
---|
128 | BOOL WINAPI CertSelectCertificateA(PCERT_SELECT_STRUCT_A pCertSelectInfo);
|
---|
129 | BOOL WINAPI CertSelectCertificateW(PCERT_SELECT_STRUCT_W pCertSelectInfo);
|
---|
130 | #define CertSelectCertificate WINELIB_NAME_AW(CertSelectCertificate)
|
---|
131 |
|
---|
132 | #define CM_VIEWFLAGS_MASK 0x00ffffff
|
---|
133 | #define CM_ENABLEHOOK 0x00000001
|
---|
134 | #define CM_SHOW_HELP 0x00000002
|
---|
135 | #define CM_SHOW_HELPICON 0x00000004
|
---|
136 | #define CM_ENABLETEMPLATE 0x00000008
|
---|
137 | #define CM_HIDE_ADVANCEPAGE 0x00000010
|
---|
138 | #define CM_HIDE_TRUSTPAGE 0x00000020
|
---|
139 | #define CM_NO_NAMECHANGE 0x00000040
|
---|
140 | #define CM_NO_EDITTRUST 0x00000080
|
---|
141 | #define CM_HIDE_DETAILPAGE 0x00000100
|
---|
142 | #define CM_ADD_CERT_STORES 0x00000200
|
---|
143 | #define CERTVIEW_CRYPTUI_LPARAM 0x00800000
|
---|
144 |
|
---|
145 | typedef struct tagCERT_VIEWPROPERTIES_STRUCT_A
|
---|
146 | {
|
---|
147 | DWORD dwSize;
|
---|
148 | HWND hwndParent;
|
---|
149 | HINSTANCE hInstance;
|
---|
150 | DWORD dwFlags;
|
---|
151 | LPCSTR szTitle;
|
---|
152 | PCCERT_CONTEXT pCertContext;
|
---|
153 | LPSTR *arrayPurposes;
|
---|
154 | DWORD cArrayPurposes;
|
---|
155 | DWORD cRootStores;
|
---|
156 | HCERTSTORE *rghstoreRoots;
|
---|
157 | DWORD cStores;
|
---|
158 | HCERTSTORE *rghstoreCAs;
|
---|
159 | DWORD cTrustStores;
|
---|
160 | HCERTSTORE *rghstoreTrust;
|
---|
161 | HCRYPTPROV hprov;
|
---|
162 | DWORD lCustData;
|
---|
163 | DWORD dwPad;
|
---|
164 | LPCSTR szHelpFileName;
|
---|
165 | DWORD dwHelpId;
|
---|
166 | DWORD nStartPage;
|
---|
167 | DWORD cArrayPropSheetPages;
|
---|
168 | /* FIXME: PSDK declares arrayPropSheetPages as a PROPSHEETPAGE *, which we
|
---|
169 | * don't allow in our own headers. It's probably wrong, but we're not
|
---|
170 | * compatible.
|
---|
171 | */
|
---|
172 | PROPSHEETPAGEA *arrayPropSheetPages;
|
---|
173 | } CERT_VIEWPROPERTIES_STRUCT_A, *PCERT_VIEWPROPERTIES_STRUCT_A;
|
---|
174 |
|
---|
175 | typedef struct tagCERT_VIEWPROPERTIES_STRUCT_W
|
---|
176 | {
|
---|
177 | DWORD dwSize;
|
---|
178 | HWND hwndParent;
|
---|
179 | HINSTANCE hInstance;
|
---|
180 | DWORD dwFlags;
|
---|
181 | LPCWSTR szTitle;
|
---|
182 | PCCERT_CONTEXT pCertContext;
|
---|
183 | LPSTR *arrayPurposes;
|
---|
184 | DWORD cArrayPurposes;
|
---|
185 | DWORD cRootStores;
|
---|
186 | HCERTSTORE *rghstoreRoots;
|
---|
187 | DWORD cStores;
|
---|
188 | HCERTSTORE *rghstoreCAs;
|
---|
189 | DWORD cTrustStores;
|
---|
190 | HCERTSTORE *rghstoreTrust;
|
---|
191 | HCRYPTPROV hprov;
|
---|
192 | DWORD lCustData;
|
---|
193 | DWORD dwPad;
|
---|
194 | LPCWSTR szHelpFileName;
|
---|
195 | DWORD dwHelpId;
|
---|
196 | DWORD nStartPage;
|
---|
197 | DWORD cArrayPropSheetPages;
|
---|
198 | /* FIXME: PSDK declares arrayPropSheetPages as a PROPSHEETPAGE *, which we
|
---|
199 | * don't allow in our own headers. It's probably wrong, but we're not
|
---|
200 | * compatible.
|
---|
201 | */
|
---|
202 | PROPSHEETPAGEW *arrayPropSheetPages;
|
---|
203 | } CERT_VIEWPROPERTIES_STRUCT_W, *PCERT_VIEWPROPERTIES_STRUCT_W;
|
---|
204 |
|
---|
205 | #define CERT_VIEWPROPERTIES_STRUCT WINELIB_NAME_AW(CERT_VIEWPROPERTIES_STRUCT_)
|
---|
206 | #define PCERT_VIEWPROPERTIES_STRUCT \
|
---|
207 | WINELIB_NAME_AW(PCERT_VIEWPROPERTIES_STRUCT_)
|
---|
208 |
|
---|
209 | BOOL WINAPI CertViewPropertiesA(PCERT_VIEWPROPERTIES_STRUCT_A pCertViewInfo);
|
---|
210 | BOOL WINAPI CertViewPropertiesW(PCERT_VIEWPROPERTIES_STRUCT_W pCertViewInfo);
|
---|
211 | #define CertViewProperties WINELIB_NAME_AW(CertViewProperties)
|
---|
212 |
|
---|
213 | #define CERT_FILTER_OP_EXISTS 1
|
---|
214 | #define CERT_FILTER_OP_NOT_EXISTS 2
|
---|
215 | #define CERT_FILTER_OP_EQUALITY 3
|
---|
216 |
|
---|
217 | typedef struct tagCMOID
|
---|
218 | {
|
---|
219 | LPCSTR szExtensionOID;
|
---|
220 | DWORD dwTestOperation;
|
---|
221 | LPBYTE pbTestData;
|
---|
222 | DWORD cbTestData;
|
---|
223 | } CERT_FILTER_EXTENSION_MATCH;
|
---|
224 |
|
---|
225 | #define CERT_FILTER_INCLUDE_V1_CERTS 0x0001
|
---|
226 | #define CERT_FILTER_VALID_TIME_RANGE 0x0002
|
---|
227 | #define CERT_FILTER_VALID_SIGNATURE 0x0004
|
---|
228 | #define CERT_FILTER_LEAF_CERTS_ONLY 0x0008
|
---|
229 | #define CERT_FILTER_ISSUER_CERTS_ONLY 0x0010
|
---|
230 | #define CERT_FILTER_KEY_EXISTS 0x0020
|
---|
231 |
|
---|
232 | typedef struct tagCMFLTR
|
---|
233 | {
|
---|
234 | DWORD dwSize;
|
---|
235 | DWORD cExtensionChecks;
|
---|
236 | CERT_FILTER_EXTENSION_MATCH *arrayExtensionChecks;
|
---|
237 | DWORD dwCheckingFlags;
|
---|
238 | } CERT_FILTER_DATA;
|
---|
239 |
|
---|
240 | DWORD WINAPI GetFriendlyNameOfCertA(PCCERT_CONTEXT pccert, LPSTR pchBuffer,
|
---|
241 | DWORD cchBuffer);
|
---|
242 | DWORD WINAPI GetFriendlyNameOfCertW(PCCERT_CONTEXT pccert, LPWSTR pchBuffer,
|
---|
243 | DWORD cchBuffer);
|
---|
244 | #define GetFriendlyNameOfCert WINELIB_NAME_AW(GetFriendlyNameOfCert)
|
---|
245 |
|
---|
246 | #define CERT_CERTIFICATE_ACTION_VERIFY \
|
---|
247 | { 0x7801ebd0, 0xcf4b, 0x11d0, { 0x85,0x1f,0x00,0x60,0x97,0x93,0x87,0xea }}
|
---|
248 | #define szCERT_CERTIFICATE_ACTION_VERIFY \
|
---|
249 | "{7801ebd0-cf4b-11d0-851f-0060979387ea}"
|
---|
250 |
|
---|
251 | typedef HRESULT (WINAPI *PFNTRUSTHELPER)(PCCERT_CONTEXT, DWORD, BOOL, LPBYTE);
|
---|
252 |
|
---|
253 | #define CERT_VALIDITY_MASK_VALIDITY 0x0000ffff
|
---|
254 | #define CERT_VALIDITY_BEFORE_START 0x00000001
|
---|
255 | #define CERT_VALIDITY_AFTER_END 0x00000002
|
---|
256 | #define CERT_VALIDITY_SIGNATURE_FAILS 0x00000004
|
---|
257 | #define CERT_VALIDITY_CERTIFICATE_REVOKED 0x00000008
|
---|
258 | #define CERT_VALIDITY_KEY_USAGE_EXT_FAILURE 0x00000010
|
---|
259 | #define CERT_VALIDITY_EXTENDED_USAGE_FAILURE 0x00000020
|
---|
260 | #define CERT_VALIDITY_NAME_CONSTRAINTS_FAILURE 0x00000040
|
---|
261 | #define CERT_VALIDITY_UNKNOWN_CRITICAL_EXTENSION 0x00000080
|
---|
262 | #define CERT_VALIDITY_ISSUER_INVALID 0x00000100
|
---|
263 | #define CERT_VALIDITY_OTHER_EXTENSION_FAILURE 0x00000200
|
---|
264 | #define CERT_VALIDITY_PERIOD_NESTING_FAILURE 0x00000400
|
---|
265 | #define CERT_VALIDITY_OTHER_ERROR 0x00000800
|
---|
266 |
|
---|
267 | #define CERT_VALIDITY_MASK_TRUST 0xffff0000
|
---|
268 | #define CERT_VALIDITY_EXPLICITLY_DISTRUSTED 0x01000000
|
---|
269 | #define CERT_VALIDITY_ISSUER_DISTRUST 0x02000000
|
---|
270 | #define CERT_VALIDITY_NO_ISSUER_CERT_FOUND 0x10000000
|
---|
271 | #define CERT_VALIDITY_NO_CRL_FOUND 0x20000000
|
---|
272 | #define CERT_VALIDITY_CRL_OUT_OF_DATE 0x40000000
|
---|
273 | #define CERT_VALIDITY_NO_TRUST_DATA 0x80000000
|
---|
274 |
|
---|
275 | #define CERT_TRUST_MASK 0x00ffffff
|
---|
276 | #define CERT_TRUST_DO_FULL_SEARCH 0x00000001
|
---|
277 | #define CERT_TRUST_PERMIT_MISSING_CRLS 0x00000002
|
---|
278 | #define CERT_TRUST_DO_FULL_TRUST 0x00000005
|
---|
279 | #define CERT_TRUST_ADD_CERT_STORES CM_ADD_CERT_STORES
|
---|
280 |
|
---|
281 | typedef struct _CERT_VERIFY_CERTIFICATE_TRUST
|
---|
282 | {
|
---|
283 | DWORD cbSize;
|
---|
284 | PCCERT_CONTEXT pccert;
|
---|
285 | DWORD dwFlags;
|
---|
286 | DWORD dwIgnoreErr;
|
---|
287 | DWORD *pdwErrors;
|
---|
288 | LPSTR pszUsageOid;
|
---|
289 | HCRYPTPROV hprov;
|
---|
290 | DWORD cRootStores;
|
---|
291 | HCERTSTORE *rghstoreRoots;
|
---|
292 | DWORD cStores;
|
---|
293 | HCERTSTORE *rghstoreCAs;
|
---|
294 | DWORD cTrustStores;
|
---|
295 | HCERTSTORE *rghstoreTrust;
|
---|
296 | DWORD lCustData;
|
---|
297 | PFNTRUSTHELPER pfnTrustHelper;
|
---|
298 | DWORD *pcchain;
|
---|
299 | PCCERT_CONTEXT **prgChain;
|
---|
300 | DWORD **prgdwErrors;
|
---|
301 | DATA_BLOB **prgpbTrustInfo;
|
---|
302 | } CERT_VERIFY_CERTIFICATE_TRUST, *PCERT_VERIFY_CERTIFICATE_TRUST;
|
---|
303 |
|
---|
304 | #define CTL_MODIFY_REQUEST_ADD_NOT_TRUSTED 1
|
---|
305 | #define CTL_MODIFY_REQUEST_REMOVE 2
|
---|
306 | #define CTL_MODIFY_REQUEST_ADD_TRUSTED 3
|
---|
307 |
|
---|
308 | typedef struct _CTL_MODIFY_REQUEST
|
---|
309 | {
|
---|
310 | PCCERT_CONTEXT pccert;
|
---|
311 | DWORD dwOperation;
|
---|
312 | DWORD dwError;
|
---|
313 | } CTL_MODIFY_REQUEST, *PCTL_MODIFY_REQUEST;
|
---|
314 |
|
---|
315 | HRESULT WINAPI CertModifyCertificatesToTrust(int cCertStore,
|
---|
316 | PCTL_MODIFY_REQUEST rgCerts, LPCSTR szPurpose, HWND hwnd,
|
---|
317 | HCERTSTORE hcertstoreTrust);
|
---|
318 |
|
---|
319 | #ifdef __cplusplus
|
---|
320 | }
|
---|
321 | #endif
|
---|
322 |
|
---|
323 | #endif
|
---|