1 | /**
|
---|
2 | * This file has no copyright assigned and is placed in the Public Domain.
|
---|
3 | * This file is part of the mingw-w64 runtime package.
|
---|
4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
---|
5 | */
|
---|
6 | #ifndef WINTRUST_H
|
---|
7 | #define WINTRUST_H
|
---|
8 |
|
---|
9 | #include <wincrypt.h>
|
---|
10 |
|
---|
11 | #ifdef __cplusplus
|
---|
12 | extern "C"
|
---|
13 | {
|
---|
14 | #endif
|
---|
15 |
|
---|
16 | #ifndef WIN_CERT_REVISION_1_0
|
---|
17 | #define WT_DEFINE_ALL_APIS
|
---|
18 | #else
|
---|
19 | #undef WT_DEFINE_ALL_APIS
|
---|
20 | #endif
|
---|
21 |
|
---|
22 | #include <pshpack8.h>
|
---|
23 |
|
---|
24 | #define WTD_UI_ALL 1
|
---|
25 | #define WTD_UI_NONE 2
|
---|
26 | #define WTD_UI_NOBAD 3
|
---|
27 | #define WTD_UI_NOGOOD 4
|
---|
28 |
|
---|
29 | #define WTD_REVOKE_NONE 0x00000000
|
---|
30 | #define WTD_REVOKE_WHOLECHAIN 0x00000001
|
---|
31 |
|
---|
32 | #define WTD_CHOICE_FILE 1
|
---|
33 | #define WTD_CHOICE_CATALOG 2
|
---|
34 | #define WTD_CHOICE_BLOB 3
|
---|
35 | #define WTD_CHOICE_SIGNER 4
|
---|
36 | #define WTD_CHOICE_CERT 5
|
---|
37 |
|
---|
38 | #define WTD_STATEACTION_IGNORE 0x00000000
|
---|
39 | #define WTD_STATEACTION_VERIFY 0x00000001
|
---|
40 | #define WTD_STATEACTION_CLOSE 0x00000002
|
---|
41 | #define WTD_STATEACTION_AUTO_CACHE 0x00000003
|
---|
42 | #define WTD_STATEACTION_AUTO_CACHE_FLUSH 0x00000004
|
---|
43 |
|
---|
44 | #define WTD_PROV_FLAGS_MASK 0x0000FFFF
|
---|
45 | #define WTD_USE_IE4_TRUST_FLAG 0x00000001
|
---|
46 | #define WTD_NO_IE4_CHAIN_FLAG 0x00000002
|
---|
47 | #define WTD_NO_POLICY_USAGE_FLAG 0x00000004
|
---|
48 | #define WTD_REVOCATION_CHECK_NONE 0x00000010
|
---|
49 | #define WTD_REVOCATION_CHECK_END_CERT 0x00000020
|
---|
50 | #define WTD_REVOCATION_CHECK_CHAIN 0x00000040
|
---|
51 | #define WTD_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT 0x00000080
|
---|
52 | #define WTD_SAFER_FLAG 0x00000100
|
---|
53 | #define WTD_HASH_ONLY_FLAG 0x00000200
|
---|
54 | #define WTD_USE_DEFAULT_OSVER_CHECK 0x00000400
|
---|
55 | #define WTD_LIFETIME_SIGNING_FLAG 0x00000800
|
---|
56 | #define WTD_CACHE_ONLY_URL_RETRIEVAL 0x00001000
|
---|
57 |
|
---|
58 | #define WTD_UICONTEXT_EXECUTE 0
|
---|
59 | #define WTD_UICONTEXT_INSTALL 1
|
---|
60 |
|
---|
61 | typedef struct _WINTRUST_DATA {
|
---|
62 | DWORD cbStruct;
|
---|
63 | LPVOID pPolicyCallbackData;
|
---|
64 | LPVOID pSIPClientData;
|
---|
65 | DWORD dwUIChoice;
|
---|
66 | DWORD fdwRevocationChecks;
|
---|
67 | DWORD dwUnionChoice;
|
---|
68 | __C89_NAMELESS union {
|
---|
69 | struct WINTRUST_FILE_INFO_ *pFile;
|
---|
70 | struct WINTRUST_CATALOG_INFO_ *pCatalog;
|
---|
71 | struct WINTRUST_BLOB_INFO_ *pBlob;
|
---|
72 | struct WINTRUST_SGNR_INFO_ *pSgnr;
|
---|
73 | struct WINTRUST_CERT_INFO_ *pCert;
|
---|
74 | };
|
---|
75 | DWORD dwStateAction;
|
---|
76 | HANDLE hWVTStateData;
|
---|
77 | WCHAR *pwszURLReference;
|
---|
78 | DWORD dwProvFlags;
|
---|
79 | DWORD dwUIContext;
|
---|
80 | } WINTRUST_DATA,*PWINTRUST_DATA;
|
---|
81 |
|
---|
82 | typedef struct WINTRUST_FILE_INFO_ {
|
---|
83 | DWORD cbStruct;
|
---|
84 | LPCWSTR pcwszFilePath;
|
---|
85 | HANDLE hFile;
|
---|
86 | GUID *pgKnownSubject;
|
---|
87 | } WINTRUST_FILE_INFO,*PWINTRUST_FILE_INFO;
|
---|
88 |
|
---|
89 | typedef HANDLE HCATADMIN;
|
---|
90 |
|
---|
91 | typedef struct WINTRUST_CATALOG_INFO_ {
|
---|
92 | DWORD cbStruct;
|
---|
93 | DWORD dwCatalogVersion;
|
---|
94 | LPCWSTR pcwszCatalogFilePath;
|
---|
95 | LPCWSTR pcwszMemberTag;
|
---|
96 | LPCWSTR pcwszMemberFilePath;
|
---|
97 | HANDLE hMemberFile;
|
---|
98 | BYTE *pbCalculatedFileHash;
|
---|
99 | DWORD cbCalculatedFileHash;
|
---|
100 | PCCTL_CONTEXT pcCatalogContext;
|
---|
101 | #if (NTDDI_VERSION >= NTDDI_WIN8)
|
---|
102 | HCATADMIN hCatAdmin;
|
---|
103 | #endif
|
---|
104 | } WINTRUST_CATALOG_INFO,*PWINTRUST_CATALOG_INFO;
|
---|
105 |
|
---|
106 | typedef struct WINTRUST_BLOB_INFO_ {
|
---|
107 | DWORD cbStruct;
|
---|
108 | GUID gSubject;
|
---|
109 | LPCWSTR pcwszDisplayName;
|
---|
110 | DWORD cbMemObject;
|
---|
111 | BYTE *pbMemObject;
|
---|
112 | DWORD cbMemSignedMsg;
|
---|
113 | BYTE *pbMemSignedMsg;
|
---|
114 | } WINTRUST_BLOB_INFO,*PWINTRUST_BLOB_INFO;
|
---|
115 |
|
---|
116 | typedef struct WINTRUST_SGNR_INFO_ {
|
---|
117 | DWORD cbStruct;
|
---|
118 | LPCWSTR pcwszDisplayName;
|
---|
119 | CMSG_SIGNER_INFO *psSignerInfo;
|
---|
120 | DWORD chStores;
|
---|
121 | HCERTSTORE *pahStores;
|
---|
122 | } WINTRUST_SGNR_INFO,*PWINTRUST_SGNR_INFO;
|
---|
123 |
|
---|
124 | #define WTCI_DONT_OPEN_STORES 0x00000001
|
---|
125 | #define WTCI_OPEN_ONLY_ROOT 0x00000002
|
---|
126 |
|
---|
127 | typedef struct WINTRUST_CERT_INFO_ {
|
---|
128 | DWORD cbStruct;
|
---|
129 | LPCWSTR pcwszDisplayName;
|
---|
130 | CERT_CONTEXT *psCertContext;
|
---|
131 | DWORD chStores;
|
---|
132 | HCERTSTORE *pahStores;
|
---|
133 | DWORD dwFlags;
|
---|
134 | FILETIME *psftVerifyAsOf;
|
---|
135 | } WINTRUST_CERT_INFO,*PWINTRUST_CERT_INFO;
|
---|
136 |
|
---|
137 | #include <poppack.h>
|
---|
138 |
|
---|
139 | extern LONG WINAPI WinVerifyTrust(HWND hwnd,GUID *pgActionID,LPVOID pWVTData);
|
---|
140 | extern HRESULT WINAPI WinVerifyTrustEx(HWND hwnd,GUID *pgActionID,WINTRUST_DATA *pWinTrustData);
|
---|
141 |
|
---|
142 | #define WTPF_TRUSTTEST 0x00000020
|
---|
143 | #define WTPF_TESTCANBEVALID 0x00000080
|
---|
144 | #define WTPF_IGNOREEXPIRATION 0x00000100
|
---|
145 | #define WTPF_IGNOREREVOKATION 0x00000200
|
---|
146 | #define WTPF_OFFLINEOK_IND 0x00000400
|
---|
147 | #define WTPF_OFFLINEOK_COM 0x00000800
|
---|
148 | #define WTPF_OFFLINEOKNBU_IND 0x00001000
|
---|
149 | #define WTPF_OFFLINEOKNBU_COM 0x00002000
|
---|
150 | #define WTPF_VERIFY_V1_OFF 0x00010000
|
---|
151 | #define WTPF_IGNOREREVOCATIONONTS 0x00020000
|
---|
152 | #define WTPF_ALLOWONLYPERTRUST 0x00040000
|
---|
153 |
|
---|
154 | extern void WINAPI WintrustGetRegPolicyFlags(DWORD *pdwPolicyFlags);
|
---|
155 | extern WINBOOL WINAPI WintrustSetRegPolicyFlags(DWORD dwPolicyFlags);
|
---|
156 |
|
---|
157 | #define TRUSTERROR_STEP_WVTPARAMS 0
|
---|
158 | #define TRUSTERROR_STEP_FILEIO 2
|
---|
159 | #define TRUSTERROR_STEP_SIP 3
|
---|
160 | #define TRUSTERROR_STEP_SIPSUBJINFO 5
|
---|
161 | #define TRUSTERROR_STEP_CATALOGFILE 6
|
---|
162 | #define TRUSTERROR_STEP_CERTSTORE 7
|
---|
163 | #define TRUSTERROR_STEP_MESSAGE 8
|
---|
164 | #define TRUSTERROR_STEP_MSG_SIGNERCOUNT 9
|
---|
165 | #define TRUSTERROR_STEP_MSG_INNERCNTTYPE 10
|
---|
166 | #define TRUSTERROR_STEP_MSG_INNERCNT 11
|
---|
167 | #define TRUSTERROR_STEP_MSG_STORE 12
|
---|
168 | #define TRUSTERROR_STEP_MSG_SIGNERINFO 13
|
---|
169 | #define TRUSTERROR_STEP_MSG_SIGNERCERT 14
|
---|
170 | #define TRUSTERROR_STEP_MSG_CERTCHAIN 15
|
---|
171 | #define TRUSTERROR_STEP_MSG_COUNTERSIGINFO 16
|
---|
172 | #define TRUSTERROR_STEP_MSG_COUNTERSIGCERT 17
|
---|
173 | #define TRUSTERROR_STEP_VERIFY_MSGHASH 18
|
---|
174 | #define TRUSTERROR_STEP_VERIFY_MSGINDIRECTDATA 19
|
---|
175 |
|
---|
176 | #define TRUSTERROR_STEP_FINAL_WVTINIT 30
|
---|
177 | #define TRUSTERROR_STEP_FINAL_INITPROV 31
|
---|
178 | #define TRUSTERROR_STEP_FINAL_OBJPROV 32
|
---|
179 | #define TRUSTERROR_STEP_FINAL_SIGPROV 33
|
---|
180 | #define TRUSTERROR_STEP_FINAL_CERTPROV 34
|
---|
181 | #define TRUSTERROR_STEP_FINAL_CERTCHKPROV 35
|
---|
182 | #define TRUSTERROR_STEP_FINAL_POLICYPROV 36
|
---|
183 | #define TRUSTERROR_STEP_FINAL_UIPROV 37
|
---|
184 |
|
---|
185 | #define TRUSTERROR_MAX_STEPS 38
|
---|
186 |
|
---|
187 | typedef void *(*PFN_CPD_MEM_ALLOC)(DWORD cbSize);
|
---|
188 | typedef void (*PFN_CPD_MEM_FREE)(void *pvMem2Free);
|
---|
189 | typedef WINBOOL (*PFN_CPD_ADD_STORE)(struct _CRYPT_PROVIDER_DATA *pProvData,HCERTSTORE hStore2Add);
|
---|
190 | typedef WINBOOL (*PFN_CPD_ADD_SGNR)(struct _CRYPT_PROVIDER_DATA *pProvData,WINBOOL fCounterSigner,DWORD idxSigner,struct _CRYPT_PROVIDER_SGNR *pSgnr2Add);
|
---|
191 | typedef WINBOOL (*PFN_CPD_ADD_CERT)(struct _CRYPT_PROVIDER_DATA *pProvData,DWORD idxSigner,WINBOOL fCounterSigner,DWORD idxCounterSigner,PCCERT_CONTEXT pCert2Add);
|
---|
192 | typedef WINBOOL (*PFN_CPD_ADD_PRIVDATA)(struct _CRYPT_PROVIDER_DATA *pProvData,struct _CRYPT_PROVIDER_PRIVDATA *pPrivData2Add);
|
---|
193 | typedef HRESULT (*PFN_PROVIDER_INIT_CALL)(struct _CRYPT_PROVIDER_DATA *pProvData);
|
---|
194 | typedef HRESULT (*PFN_PROVIDER_OBJTRUST_CALL)(struct _CRYPT_PROVIDER_DATA *pProvData);
|
---|
195 | typedef HRESULT (*PFN_PROVIDER_SIGTRUST_CALL)(struct _CRYPT_PROVIDER_DATA *pProvData);
|
---|
196 | typedef HRESULT (*PFN_PROVIDER_CERTTRUST_CALL)(struct _CRYPT_PROVIDER_DATA *pProvData);
|
---|
197 | typedef HRESULT (*PFN_PROVIDER_FINALPOLICY_CALL)(struct _CRYPT_PROVIDER_DATA *pProvData);
|
---|
198 | typedef HRESULT (*PFN_PROVIDER_TESTFINALPOLICY_CALL)(struct _CRYPT_PROVIDER_DATA *pProvData);
|
---|
199 | typedef HRESULT (*PFN_PROVIDER_CLEANUP_CALL)(struct _CRYPT_PROVIDER_DATA *pProvData);
|
---|
200 | typedef WINBOOL (*PFN_PROVIDER_CERTCHKPOLICY_CALL)(struct _CRYPT_PROVIDER_DATA *pProvData,DWORD idxSigner,WINBOOL fCounterSignerChain,DWORD idxCounterSigner);
|
---|
201 |
|
---|
202 | #define WVT_OFFSETOF(t,f) ((ULONG)((ULONG_PTR)(&((t*)0)->f)))
|
---|
203 | #define WVT_ISINSTRUCT(structtypedef,structpassedsize,member) ((WVT_OFFSETOF(structtypedef,member) < structpassedsize) ? TRUE : FALSE)
|
---|
204 | #define WVT_IS_CBSTRUCT_GT_MEMBEROFFSET(structtypedef,structpassedsize,member) WVT_ISINSTRUCT(structtypedef,structpassedsize,member)
|
---|
205 |
|
---|
206 | #include <pshpack8.h>
|
---|
207 |
|
---|
208 | #define CPD_CHOICE_SIP 1
|
---|
209 |
|
---|
210 | #define CPD_USE_NT5_CHAIN_FLAG 0x80000000
|
---|
211 | #define CPD_REVOCATION_CHECK_NONE 0x00010000
|
---|
212 | #define CPD_REVOCATION_CHECK_END_CERT 0x00020000
|
---|
213 | #define CPD_REVOCATION_CHECK_CHAIN 0x00040000
|
---|
214 | #define CPD_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT 0x00080000
|
---|
215 |
|
---|
216 | #define CPD_UISTATE_MODE_PROMPT 0x00000000
|
---|
217 | #define CPD_UISTATE_MODE_BLOCK 0x00000001
|
---|
218 | #define CPD_UISTATE_MODE_ALLOW 0x00000002
|
---|
219 | #define CPD_UISTATE_MODE_MASK 0x00000003
|
---|
220 |
|
---|
221 | typedef struct _CRYPT_PROVIDER_DATA {
|
---|
222 | DWORD cbStruct;
|
---|
223 | WINTRUST_DATA *pWintrustData;
|
---|
224 | WINBOOL fOpenedFile;
|
---|
225 | HWND hWndParent;
|
---|
226 | GUID *pgActionID;
|
---|
227 | HCRYPTPROV hProv;
|
---|
228 | DWORD dwError;
|
---|
229 | DWORD dwRegSecuritySettings;
|
---|
230 | DWORD dwRegPolicySettings;
|
---|
231 | struct _CRYPT_PROVIDER_FUNCTIONS *psPfns;
|
---|
232 | DWORD cdwTrustStepErrors;
|
---|
233 | DWORD *padwTrustStepErrors;
|
---|
234 | DWORD chStores;
|
---|
235 | HCERTSTORE *pahStores;
|
---|
236 | DWORD dwEncoding;
|
---|
237 | HCRYPTMSG hMsg;
|
---|
238 | DWORD csSigners;
|
---|
239 | struct _CRYPT_PROVIDER_SGNR *pasSigners;
|
---|
240 | DWORD csProvPrivData;
|
---|
241 | struct _CRYPT_PROVIDER_PRIVDATA *pasProvPrivData;
|
---|
242 | DWORD dwSubjectChoice;
|
---|
243 | __C89_NAMELESS union {
|
---|
244 | struct _PROVDATA_SIP *pPDSip;
|
---|
245 | };
|
---|
246 | char *pszUsageOID;
|
---|
247 | WINBOOL fRecallWithState;
|
---|
248 | FILETIME sftSystemTime;
|
---|
249 | char *pszCTLSignerUsageOID;
|
---|
250 | DWORD dwProvFlags;
|
---|
251 | DWORD dwFinalError;
|
---|
252 | PCERT_USAGE_MATCH pRequestUsage;
|
---|
253 | DWORD dwTrustPubSettings;
|
---|
254 | DWORD dwUIStateFlags;
|
---|
255 | } CRYPT_PROVIDER_DATA,*PCRYPT_PROVIDER_DATA;
|
---|
256 |
|
---|
257 | typedef struct _CRYPT_PROVIDER_FUNCTIONS {
|
---|
258 | DWORD cbStruct;
|
---|
259 | PFN_CPD_MEM_ALLOC pfnAlloc;
|
---|
260 | PFN_CPD_MEM_FREE pfnFree;
|
---|
261 | PFN_CPD_ADD_STORE pfnAddStore2Chain;
|
---|
262 | PFN_CPD_ADD_SGNR pfnAddSgnr2Chain;
|
---|
263 | PFN_CPD_ADD_CERT pfnAddCert2Chain;
|
---|
264 | PFN_CPD_ADD_PRIVDATA pfnAddPrivData2Chain;
|
---|
265 | PFN_PROVIDER_INIT_CALL pfnInitialize;
|
---|
266 | PFN_PROVIDER_OBJTRUST_CALL pfnObjectTrust;
|
---|
267 | PFN_PROVIDER_SIGTRUST_CALL pfnSignatureTrust;
|
---|
268 | PFN_PROVIDER_CERTTRUST_CALL pfnCertificateTrust;
|
---|
269 | PFN_PROVIDER_FINALPOLICY_CALL pfnFinalPolicy;
|
---|
270 | PFN_PROVIDER_CERTCHKPOLICY_CALL pfnCertCheckPolicy;
|
---|
271 | PFN_PROVIDER_TESTFINALPOLICY_CALL pfnTestFinalPolicy;
|
---|
272 | struct _CRYPT_PROVUI_FUNCS *psUIpfns;
|
---|
273 | PFN_PROVIDER_CLEANUP_CALL pfnCleanupPolicy;
|
---|
274 | } CRYPT_PROVIDER_FUNCTIONS,*PCRYPT_PROVIDER_FUNCTIONS;
|
---|
275 |
|
---|
276 | typedef WINBOOL (*PFN_PROVUI_CALL)(HWND hWndSecurityDialog,struct _CRYPT_PROVIDER_DATA *pProvData);
|
---|
277 |
|
---|
278 | typedef struct _CRYPT_PROVUI_FUNCS {
|
---|
279 | DWORD cbStruct;
|
---|
280 | struct _CRYPT_PROVUI_DATA *psUIData;
|
---|
281 | PFN_PROVUI_CALL pfnOnMoreInfoClick;
|
---|
282 | PFN_PROVUI_CALL pfnOnMoreInfoClickDefault;
|
---|
283 | PFN_PROVUI_CALL pfnOnAdvancedClick;
|
---|
284 | PFN_PROVUI_CALL pfnOnAdvancedClickDefault;
|
---|
285 | } CRYPT_PROVUI_FUNCS,*PCRYPT_PROVUI_FUNCS;
|
---|
286 |
|
---|
287 | typedef struct _CRYPT_PROVUI_DATA {
|
---|
288 | DWORD cbStruct;
|
---|
289 | DWORD dwFinalError;
|
---|
290 | WCHAR *pYesButtonText;
|
---|
291 | WCHAR *pNoButtonText;
|
---|
292 | WCHAR *pMoreInfoButtonText;
|
---|
293 | WCHAR *pAdvancedLinkText;
|
---|
294 | WCHAR *pCopyActionText;
|
---|
295 | WCHAR *pCopyActionTextNoTS;
|
---|
296 | WCHAR *pCopyActionTextNotSigned;
|
---|
297 | } CRYPT_PROVUI_DATA,*PCRYPT_PROVUI_DATA;
|
---|
298 |
|
---|
299 | #define SGNR_TYPE_TIMESTAMP 0x00000010
|
---|
300 |
|
---|
301 | typedef struct _CRYPT_PROVIDER_SGNR {
|
---|
302 | DWORD cbStruct;
|
---|
303 | FILETIME sftVerifyAsOf;
|
---|
304 | DWORD csCertChain;
|
---|
305 | struct _CRYPT_PROVIDER_CERT *pasCertChain;
|
---|
306 | DWORD dwSignerType;
|
---|
307 | CMSG_SIGNER_INFO *psSigner;
|
---|
308 | DWORD dwError;
|
---|
309 | DWORD csCounterSigners;
|
---|
310 | struct _CRYPT_PROVIDER_SGNR *pasCounterSigners;
|
---|
311 | PCCERT_CHAIN_CONTEXT pChainContext;
|
---|
312 | } CRYPT_PROVIDER_SGNR,*PCRYPT_PROVIDER_SGNR;
|
---|
313 |
|
---|
314 | #define CERT_CONFIDENCE_SIG 0x10000000
|
---|
315 | #define CERT_CONFIDENCE_TIME 0x01000000
|
---|
316 | #define CERT_CONFIDENCE_TIMENEST 0x00100000
|
---|
317 | #define CERT_CONFIDENCE_AUTHIDEXT 0x00010000
|
---|
318 | #define CERT_CONFIDENCE_HYGIENE 0x00001000
|
---|
319 | #define CERT_CONFIDENCE_HIGHEST 0x11111000
|
---|
320 |
|
---|
321 | typedef struct _CRYPT_PROVIDER_CERT {
|
---|
322 | DWORD cbStruct;
|
---|
323 | PCCERT_CONTEXT pCert;
|
---|
324 | WINBOOL fCommercial;
|
---|
325 | WINBOOL fTrustedRoot;
|
---|
326 | WINBOOL fSelfSigned;
|
---|
327 | WINBOOL fTestCert;
|
---|
328 | DWORD dwRevokedReason;
|
---|
329 | DWORD dwConfidence;
|
---|
330 | DWORD dwError;
|
---|
331 | CTL_CONTEXT *pTrustListContext;
|
---|
332 | WINBOOL fTrustListSignerCert;
|
---|
333 | PCCTL_CONTEXT pCtlContext;
|
---|
334 | DWORD dwCtlError;
|
---|
335 | WINBOOL fIsCyclic;
|
---|
336 | PCERT_CHAIN_ELEMENT pChainElement;
|
---|
337 | } CRYPT_PROVIDER_CERT,*PCRYPT_PROVIDER_CERT;
|
---|
338 |
|
---|
339 | typedef struct _CRYPT_PROVIDER_PRIVDATA {
|
---|
340 | DWORD cbStruct;
|
---|
341 | GUID gProviderID;
|
---|
342 | DWORD cbProvData;
|
---|
343 | void *pvProvData;
|
---|
344 | } CRYPT_PROVIDER_PRIVDATA,*PCRYPT_PROVIDER_PRIVDATA;
|
---|
345 |
|
---|
346 | typedef struct _PROVDATA_SIP {
|
---|
347 | DWORD cbStruct;
|
---|
348 | GUID gSubject;
|
---|
349 | struct SIP_DISPATCH_INFO_ *pSip;
|
---|
350 | struct SIP_DISPATCH_INFO_ *pCATSip;
|
---|
351 | struct SIP_SUBJECTINFO_ *psSipSubjectInfo;
|
---|
352 | struct SIP_SUBJECTINFO_ *psSipCATSubjectInfo;
|
---|
353 | struct SIP_INDIRECT_DATA_ *psIndirectData;
|
---|
354 | } PROVDATA_SIP,*PPROVDATA_SIP;
|
---|
355 |
|
---|
356 | #define WT_CURRENT_VERSION 0x00000200
|
---|
357 |
|
---|
358 | typedef struct _CRYPT_TRUST_REG_ENTRY {
|
---|
359 | DWORD cbStruct;
|
---|
360 | WCHAR *pwszDLLName;
|
---|
361 | WCHAR *pwszFunctionName;
|
---|
362 | } CRYPT_TRUST_REG_ENTRY,*PCRYPT_TRUST_REG_ENTRY;
|
---|
363 |
|
---|
364 | typedef struct _CRYPT_REGISTER_ACTIONID {
|
---|
365 | DWORD cbStruct;
|
---|
366 | CRYPT_TRUST_REG_ENTRY sInitProvider;
|
---|
367 | CRYPT_TRUST_REG_ENTRY sObjectProvider;
|
---|
368 | CRYPT_TRUST_REG_ENTRY sSignatureProvider;
|
---|
369 | CRYPT_TRUST_REG_ENTRY sCertificateProvider;
|
---|
370 | CRYPT_TRUST_REG_ENTRY sCertificatePolicyProvider;
|
---|
371 | CRYPT_TRUST_REG_ENTRY sFinalPolicyProvider;
|
---|
372 | CRYPT_TRUST_REG_ENTRY sTestPolicyProvider;
|
---|
373 | CRYPT_TRUST_REG_ENTRY sCleanupProvider;
|
---|
374 | } CRYPT_REGISTER_ACTIONID,*PCRYPT_REGISTER_ACTIONID;
|
---|
375 |
|
---|
376 | typedef WINBOOL (*PFN_ALLOCANDFILLDEFUSAGE)(const char *pszUsageOID,struct _CRYPT_PROVIDER_DEFUSAGE *psDefUsage);
|
---|
377 | typedef WINBOOL (*PFN_FREEDEFUSAGE)(const char *pszUsageOID,struct _CRYPT_PROVIDER_DEFUSAGE *psDefUsage);
|
---|
378 |
|
---|
379 | typedef struct _CRYPT_PROVIDER_REGDEFUSAGE {
|
---|
380 | DWORD cbStruct;
|
---|
381 | GUID *pgActionID;
|
---|
382 | WCHAR *pwszDllName;
|
---|
383 | char *pwszLoadCallbackDataFunctionName;
|
---|
384 | char *pwszFreeCallbackDataFunctionName;
|
---|
385 | } CRYPT_PROVIDER_REGDEFUSAGE,*PCRYPT_PROVIDER_REGDEFUSAGE;
|
---|
386 |
|
---|
387 | typedef struct _CRYPT_PROVIDER_DEFUSAGE {
|
---|
388 | DWORD cbStruct;
|
---|
389 | GUID gActionID;
|
---|
390 | LPVOID pDefPolicyCallbackData;
|
---|
391 | LPVOID pDefSIPClientData;
|
---|
392 | } CRYPT_PROVIDER_DEFUSAGE,*PCRYPT_PROVIDER_DEFUSAGE;
|
---|
393 |
|
---|
394 | #include <poppack.h>
|
---|
395 |
|
---|
396 | #define WT_PROVIDER_DLL_NAME L"WINTRUST.DLL"
|
---|
397 | #define WT_PROVIDER_CERTTRUST_FUNCTION L"WintrustCertificateTrust"
|
---|
398 |
|
---|
399 | extern WINBOOL WINAPI WintrustAddActionID(GUID *pgActionID,DWORD fdwFlags,CRYPT_REGISTER_ACTIONID *psProvInfo);
|
---|
400 |
|
---|
401 | #define WT_ADD_ACTION_ID_RET_RESULT_FLAG 0x1
|
---|
402 |
|
---|
403 | extern WINBOOL WINAPI WintrustRemoveActionID(GUID *pgActionID);
|
---|
404 | extern WINBOOL WINAPI WintrustLoadFunctionPointers(GUID *pgActionID,CRYPT_PROVIDER_FUNCTIONS *pPfns);
|
---|
405 | extern WINBOOL WINAPI WintrustAddDefaultForUsage(const char *pszUsageOID,CRYPT_PROVIDER_REGDEFUSAGE *psDefUsage);
|
---|
406 |
|
---|
407 | #define DWACTION_ALLOCANDFILL 1
|
---|
408 | #define DWACTION_FREE 2
|
---|
409 |
|
---|
410 | extern WINBOOL WINAPI WintrustGetDefaultForUsage(DWORD dwAction,const char *pszUsageOID,CRYPT_PROVIDER_DEFUSAGE *psUsage);
|
---|
411 | extern CRYPT_PROVIDER_SGNR *WINAPI WTHelperGetProvSignerFromChain(CRYPT_PROVIDER_DATA *pProvData,DWORD idxSigner,WINBOOL fCounterSigner,DWORD idxCounterSigner);
|
---|
412 | extern CRYPT_PROVIDER_CERT *WINAPI WTHelperGetProvCertFromChain(CRYPT_PROVIDER_SGNR *pSgnr,DWORD idxCert);
|
---|
413 | extern CRYPT_PROVIDER_DATA *WINAPI WTHelperProvDataFromStateData(HANDLE hStateData);
|
---|
414 | extern CRYPT_PROVIDER_PRIVDATA *WINAPI WTHelperGetProvPrivateDataFromChain(CRYPT_PROVIDER_DATA *pProvData,GUID *pgProviderID);
|
---|
415 | extern WINBOOL WINAPI WTHelperCertIsSelfSigned(DWORD dwEncoding,CERT_INFO *pCert);
|
---|
416 | extern HRESULT WINAPI WTHelperCertCheckValidSignature(CRYPT_PROVIDER_DATA *pProvData);
|
---|
417 |
|
---|
418 | #include <pshpack8.h>
|
---|
419 |
|
---|
420 | #define szOID_TRUSTED_CODESIGNING_CA_LIST "1.3.6.1.4.1.311.2.2.1"
|
---|
421 | #define szOID_TRUSTED_CLIENT_AUTH_CA_LIST "1.3.6.1.4.1.311.2.2.2"
|
---|
422 | #define szOID_TRUSTED_SERVER_AUTH_CA_LIST "1.3.6.1.4.1.311.2.2.3"
|
---|
423 |
|
---|
424 | #define SPC_COMMON_NAME_OBJID szOID_COMMON_NAME
|
---|
425 | #define SPC_TIME_STAMP_REQUEST_OBJID "1.3.6.1.4.1.311.3.2.1"
|
---|
426 | #define SPC_INDIRECT_DATA_OBJID "1.3.6.1.4.1.311.2.1.4"
|
---|
427 | #define SPC_SP_AGENCY_INFO_OBJID "1.3.6.1.4.1.311.2.1.10"
|
---|
428 | #define SPC_STATEMENT_TYPE_OBJID "1.3.6.1.4.1.311.2.1.11"
|
---|
429 | #define SPC_SP_OPUS_INFO_OBJID "1.3.6.1.4.1.311.2.1.12"
|
---|
430 | #define SPC_CERT_EXTENSIONS_OBJID "1.3.6.1.4.1.311.2.1.14"
|
---|
431 | #define SPC_PE_IMAGE_DATA_OBJID "1.3.6.1.4.1.311.2.1.15"
|
---|
432 | #define SPC_RAW_FILE_DATA_OBJID "1.3.6.1.4.1.311.2.1.18"
|
---|
433 | #define SPC_STRUCTURED_STORAGE_DATA_OBJID "1.3.6.1.4.1.311.2.1.19"
|
---|
434 | #define SPC_JAVA_CLASS_DATA_OBJID "1.3.6.1.4.1.311.2.1.20"
|
---|
435 | #define SPC_INDIVIDUAL_SP_KEY_PURPOSE_OBJID "1.3.6.1.4.1.311.2.1.21"
|
---|
436 | #define SPC_COMMERCIAL_SP_KEY_PURPOSE_OBJID "1.3.6.1.4.1.311.2.1.22"
|
---|
437 | #define SPC_CAB_DATA_OBJID "1.3.6.1.4.1.311.2.1.25"
|
---|
438 | #define SPC_GLUE_RDN_OBJID "1.3.6.1.4.1.311.2.1.25"
|
---|
439 | #define SPC_MINIMAL_CRITERIA_OBJID "1.3.6.1.4.1.311.2.1.26"
|
---|
440 | #define SPC_FINANCIAL_CRITERIA_OBJID "1.3.6.1.4.1.311.2.1.27"
|
---|
441 | #define SPC_LINK_OBJID "1.3.6.1.4.1.311.2.1.28"
|
---|
442 | #define SPC_SIGINFO_OBJID "1.3.6.1.4.1.311.2.1.30"
|
---|
443 |
|
---|
444 | #define CAT_NAMEVALUE_OBJID "1.3.6.1.4.1.311.12.2.1"
|
---|
445 | #define CAT_MEMBERINFO_OBJID "1.3.6.1.4.1.311.12.2.2"
|
---|
446 |
|
---|
447 | #define SPC_SP_AGENCY_INFO_STRUCT ((LPCSTR) 2000)
|
---|
448 | #define SPC_MINIMAL_CRITERIA_STRUCT ((LPCSTR) 2001)
|
---|
449 | #define SPC_FINANCIAL_CRITERIA_STRUCT ((LPCSTR) 2002)
|
---|
450 | #define SPC_INDIRECT_DATA_CONTENT_STRUCT ((LPCSTR) 2003)
|
---|
451 | #define SPC_PE_IMAGE_DATA_STRUCT ((LPCSTR) 2004)
|
---|
452 | #define SPC_LINK_STRUCT ((LPCSTR) 2005)
|
---|
453 | #define SPC_STATEMENT_TYPE_STRUCT ((LPCSTR) 2006)
|
---|
454 | #define SPC_SP_OPUS_INFO_STRUCT ((LPCSTR) 2007)
|
---|
455 | #define SPC_CAB_DATA_STRUCT ((LPCSTR) 2008)
|
---|
456 | #define SPC_JAVA_CLASS_DATA_STRUCT ((LPCSTR) 2009)
|
---|
457 |
|
---|
458 | #define SPC_SIGINFO_STRUCT ((LPCSTR) 2130)
|
---|
459 |
|
---|
460 | #define CAT_NAMEVALUE_STRUCT ((LPCSTR) 2221)
|
---|
461 | #define CAT_MEMBERINFO_STRUCT ((LPCSTR) 2222)
|
---|
462 |
|
---|
463 | #define SPC_UUID_LENGTH 16
|
---|
464 |
|
---|
465 | typedef BYTE SPC_UUID[SPC_UUID_LENGTH];
|
---|
466 |
|
---|
467 | typedef struct _SPC_SERIALIZED_OBJECT {
|
---|
468 | SPC_UUID ClassId;
|
---|
469 | CRYPT_DATA_BLOB SerializedData;
|
---|
470 | } SPC_SERIALIZED_OBJECT,*PSPC_SERIALIZED_OBJECT;
|
---|
471 |
|
---|
472 | typedef struct SPC_SIGINFO_ {
|
---|
473 | DWORD dwSipVersion;
|
---|
474 | GUID gSIPGuid;
|
---|
475 | DWORD dwReserved1;
|
---|
476 | DWORD dwReserved2;
|
---|
477 | DWORD dwReserved3;
|
---|
478 | DWORD dwReserved4;
|
---|
479 | DWORD dwReserved5;
|
---|
480 | } SPC_SIGINFO,*PSPC_SIGINFO;
|
---|
481 |
|
---|
482 | #define SPC_URL_LINK_CHOICE 1
|
---|
483 | #define SPC_MONIKER_LINK_CHOICE 2
|
---|
484 | #define SPC_FILE_LINK_CHOICE 3
|
---|
485 |
|
---|
486 | typedef struct SPC_LINK_ {
|
---|
487 | DWORD dwLinkChoice;
|
---|
488 | __C89_NAMELESS union {
|
---|
489 | LPWSTR pwszUrl;
|
---|
490 | SPC_SERIALIZED_OBJECT Moniker;
|
---|
491 | LPWSTR pwszFile;
|
---|
492 | };
|
---|
493 | } SPC_LINK,*PSPC_LINK;
|
---|
494 |
|
---|
495 | typedef struct _SPC_PE_IMAGE_DATA {
|
---|
496 | CRYPT_BIT_BLOB Flags;
|
---|
497 | PSPC_LINK pFile;
|
---|
498 | } SPC_PE_IMAGE_DATA,*PSPC_PE_IMAGE_DATA;
|
---|
499 |
|
---|
500 | typedef struct _SPC_INDIRECT_DATA_CONTENT {
|
---|
501 | CRYPT_ATTRIBUTE_TYPE_VALUE Data;
|
---|
502 | CRYPT_ALGORITHM_IDENTIFIER DigestAlgorithm;
|
---|
503 | CRYPT_HASH_BLOB Digest;
|
---|
504 | } SPC_INDIRECT_DATA_CONTENT,*PSPC_INDIRECT_DATA_CONTENT;
|
---|
505 |
|
---|
506 | typedef struct _SPC_FINANCIAL_CRITERIA {
|
---|
507 | WINBOOL fFinancialInfoAvailable;
|
---|
508 | WINBOOL fMeetsCriteria;
|
---|
509 | } SPC_FINANCIAL_CRITERIA,*PSPC_FINANCIAL_CRITERIA;
|
---|
510 |
|
---|
511 | typedef struct _SPC_IMAGE {
|
---|
512 | struct SPC_LINK_ *pImageLink;
|
---|
513 | CRYPT_DATA_BLOB Bitmap;
|
---|
514 | CRYPT_DATA_BLOB Metafile;
|
---|
515 | CRYPT_DATA_BLOB EnhancedMetafile;
|
---|
516 | CRYPT_DATA_BLOB GifFile;
|
---|
517 | } SPC_IMAGE,*PSPC_IMAGE;
|
---|
518 |
|
---|
519 | typedef struct _SPC_SP_AGENCY_INFO {
|
---|
520 | struct SPC_LINK_ *pPolicyInformation;
|
---|
521 | LPWSTR pwszPolicyDisplayText;
|
---|
522 | PSPC_IMAGE pLogoImage;
|
---|
523 | struct SPC_LINK_ *pLogoLink;
|
---|
524 | } SPC_SP_AGENCY_INFO,*PSPC_SP_AGENCY_INFO;
|
---|
525 |
|
---|
526 | typedef struct _SPC_STATEMENT_TYPE {
|
---|
527 | DWORD cKeyPurposeId;
|
---|
528 | LPSTR *rgpszKeyPurposeId;
|
---|
529 | } SPC_STATEMENT_TYPE,*PSPC_STATEMENT_TYPE;
|
---|
530 |
|
---|
531 | typedef struct _SPC_SP_OPUS_INFO {
|
---|
532 | LPCWSTR pwszProgramName;
|
---|
533 | struct SPC_LINK_ *pMoreInfo;
|
---|
534 | struct SPC_LINK_ *pPublisherInfo;
|
---|
535 | } SPC_SP_OPUS_INFO,*PSPC_SP_OPUS_INFO;
|
---|
536 |
|
---|
537 | typedef struct _CAT_NAMEVALUE {
|
---|
538 | LPWSTR pwszTag;
|
---|
539 | DWORD fdwFlags;
|
---|
540 | CRYPT_DATA_BLOB Value;
|
---|
541 | } CAT_NAMEVALUE,*PCAT_NAMEVALUE;
|
---|
542 |
|
---|
543 | typedef struct _CAT_MEMBERINFO {
|
---|
544 | LPWSTR pwszSubjGuid;
|
---|
545 | DWORD dwCertVersion;
|
---|
546 | } CAT_MEMBERINFO,*PCAT_MEMBERINFO;
|
---|
547 |
|
---|
548 | #include <poppack.h>
|
---|
549 |
|
---|
550 | #ifdef WT_DEFINE_ALL_APIS
|
---|
551 | typedef struct _WIN_CERTIFICATE {
|
---|
552 | DWORD dwLength;
|
---|
553 | WORD wRevision;
|
---|
554 | WORD wCertificateType;
|
---|
555 | BYTE bCertificate[ANYSIZE_ARRAY];
|
---|
556 | } WIN_CERTIFICATE,*LPWIN_CERTIFICATE;
|
---|
557 |
|
---|
558 | #define WIN_CERT_REVISION_1_0 (0x0100)
|
---|
559 | #define WIN_CERT_REVISION_2_0 (0x0200)
|
---|
560 | #define WIN_CERT_TYPE_X509 (0x0001)
|
---|
561 | #define WIN_CERT_TYPE_PKCS_SIGNED_DATA (0x0002)
|
---|
562 | #define WIN_CERT_TYPE_RESERVED_1 (0x0003)
|
---|
563 | #define WIN_CERT_TYPE_TS_STACK_SIGNED (0x0004)
|
---|
564 |
|
---|
565 | typedef LPVOID WIN_TRUST_SUBJECT;
|
---|
566 |
|
---|
567 | typedef struct _WIN_TRUST_ACTDATA_CONTEXT_WITH_SUBJECT {
|
---|
568 | HANDLE hClientToken;
|
---|
569 | GUID *SubjectType;
|
---|
570 | WIN_TRUST_SUBJECT Subject;
|
---|
571 | } WIN_TRUST_ACTDATA_CONTEXT_WITH_SUBJECT,*LPWIN_TRUST_ACTDATA_CONTEXT_WITH_SUBJECT;
|
---|
572 |
|
---|
573 | typedef struct _WIN_TRUST_ACTDATA_SUBJECT_ONLY {
|
---|
574 | GUID *SubjectType;
|
---|
575 | WIN_TRUST_SUBJECT Subject;
|
---|
576 | } WIN_TRUST_ACTDATA_SUBJECT_ONLY,*LPWIN_TRUST_ACTDATA_SUBJECT_ONLY;
|
---|
577 |
|
---|
578 | #define WIN_TRUST_SUBJTYPE_RAW_FILE { 0x959dc450,0x8d9e,0x11cf,{0x87,0x36,0x00,0xaa,0x00,0xa4,0x85,0xeb} }
|
---|
579 | #define WIN_TRUST_SUBJTYPE_PE_IMAGE { 0x43c9a1e0,0x8da0,0x11cf,{0x87,0x36,0x00,0xaa,0x00,0xa4,0x85,0xeb} }
|
---|
580 | #define WIN_TRUST_SUBJTYPE_JAVA_CLASS { 0x08ad3990,0x8da1,0x11cf,{0x87,0x36,0x00,0xaa,0x00,0xa4,0x85,0xeb} }
|
---|
581 | #define WIN_TRUST_SUBJTYPE_CABINET { 0xd17c5374,0xa392,0x11cf,{ 0x9d,0xf5,0x0,0xaa,0x0,0xc1,0x84,0xe0 } }
|
---|
582 |
|
---|
583 | typedef struct _WIN_TRUST_SUBJECT_FILE {
|
---|
584 | HANDLE hFile;
|
---|
585 | LPCWSTR lpPath;
|
---|
586 | } WIN_TRUST_SUBJECT_FILE,*LPWIN_TRUST_SUBJECT_FILE;
|
---|
587 |
|
---|
588 | #define WIN_TRUST_SUBJTYPE_RAW_FILEEX { 0x6f458110,0xc2f1,0x11cf,{ 0x8a,0x69,0x0,0xaa,0x0,0x6c,0x37,0x6 } }
|
---|
589 | #define WIN_TRUST_SUBJTYPE_PE_IMAGEEX { 0x6f458111,0xc2f1,0x11cf,{ 0x8a,0x69,0x0,0xaa,0x0,0x6c,0x37,0x6 } }
|
---|
590 | #define WIN_TRUST_SUBJTYPE_JAVA_CLASSEX { 0x6f458113,0xc2f1,0x11cf,{ 0x8a,0x69,0x0,0xaa,0x0,0x6c,0x37,0x6 } }
|
---|
591 | #define WIN_TRUST_SUBJTYPE_CABINETEX { 0x6f458114,0xc2f1,0x11cf,{ 0x8a,0x69,0x0,0xaa,0x0,0x6c,0x37,0x6 } }
|
---|
592 |
|
---|
593 | typedef struct _WIN_TRUST_SUBJECT_FILE_AND_DISPLAY {
|
---|
594 | HANDLE hFile;
|
---|
595 | LPCWSTR lpPath;
|
---|
596 | LPCWSTR lpDisplayName;
|
---|
597 | } WIN_TRUST_SUBJECT_FILE_AND_DISPLAY,*LPWIN_TRUST_SUBJECT_FILE_AND_DISPLAY;
|
---|
598 |
|
---|
599 | #define WIN_TRUST_SUBJTYPE_OLE_STORAGE { 0xc257e740,0x8da0,0x11cf,{0x87,0x36,0x00,0xaa,0x00,0xa4,0x85,0xeb} }
|
---|
600 | #define WIN_SPUB_ACTION_TRUSTED_PUBLISHER { 0x66426730,0x8da1,0x11cf,{0x87,0x36,0x00,0xaa,0x00,0xa4,0x85,0xeb} }
|
---|
601 | #define WIN_SPUB_ACTION_NT_ACTIVATE_IMAGE { 0x8bc96b00,0x8da1,0x11cf,{0x87,0x36,0x00,0xaa,0x00,0xa4,0x85,0xeb} }
|
---|
602 | #define WIN_SPUB_ACTION_PUBLISHED_SOFTWARE { 0x64b9d180,0x8da2,0x11cf,{0x87,0x36,0x00,0xaa,0x00,0xa4,0x85,0xeb} }
|
---|
603 |
|
---|
604 | typedef struct _WIN_SPUB_TRUSTED_PUBLISHER_DATA {
|
---|
605 | HANDLE hClientToken;
|
---|
606 | LPWIN_CERTIFICATE lpCertificate;
|
---|
607 | } WIN_SPUB_TRUSTED_PUBLISHER_DATA,*LPWIN_SPUB_TRUSTED_PUBLISHER_DATA;
|
---|
608 |
|
---|
609 | #endif /* WT_DEFINE_ALL_APIS */
|
---|
610 |
|
---|
611 | #if (_WIN32_WINNT >= 0x0600)
|
---|
612 | void WINAPI WintrustSetDefaultIncludePEPageHashes(WINBOOL fIncludePEPageHashes);
|
---|
613 | #endif /*(_WIN32_WINNT >= 0x0600)*/
|
---|
614 |
|
---|
615 | #ifdef __cplusplus
|
---|
616 | }
|
---|
617 | #endif
|
---|
618 | #endif
|
---|