2 * Copyright (C) 2004 Francois Gouget
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.
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.
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
19 #ifndef __WINE_WINTRUST_H
20 #define __WINE_WINTRUST_H
27 typedef struct WINTRUST_FILE_INFO_
30 LPCWSTR pcwszFilePath
;
33 } WINTRUST_FILE_INFO
, *PWINTRUST_FILE_INFO
;
35 typedef struct WINTRUST_CATALOG_INFO_
38 DWORD dwCatalogVersion
;
39 LPCWSTR pcwszCatalogFilePath
;
40 LPCWSTR pcwszMemberTag
;
41 LPCWSTR pcwszMemberFilePath
;
43 BYTE
* pbCalculatedFileHash
;
44 DWORD cbCalculatedFileHash
;
45 PCCTL_CONTEXT pcCatalogContext
;
46 } WINTRUST_CATALOG_INFO
, *PWINTRUST_CATALOG_INFO
;
48 typedef struct WINTRUST_BLOB_INFO_
52 LPCWSTR pcwszDisplayName
;
57 } WINTRUST_BLOB_INFO
, *PWINTRUST_BLOB_INFO
;
59 typedef struct WINTRUST_SGNR_INFO_
62 LPCWSTR pcwszDisplayName
;
63 CMSG_SIGNER_INFO
* psSignerInfo
;
65 HCERTSTORE
* pahStores
;
66 } WINTRUST_SGNR_INFO
, *PWINTRUST_SGNR_INFO
;
68 typedef struct WINTRUST_CERT_INFO_
71 LPCWSTR pcwszDisplayName
;
72 CERT_CONTEXT
* psCertContext
;
74 HCERTSTORE
* pahStores
;
76 FILETIME
* psftVerifyAsOf
;
77 } WINTRUST_CERT_INFO
, *PWINTRUST_CERT_INFO
;
82 #define WTD_UI_NOBAD 3
83 #define WTD_UI_NOGOOD 4
84 /* fdwRevocationChecks */
85 #define WTD_REVOKE_NONE 0
86 #define WTD_REVOKE_WHOLECHAIN 1
88 #define WTD_CHOICE_FILE 1
89 #define WTD_CHOICE_CATALOG 2
90 #define WTD_CHOICE_BLOB 3
91 #define WTD_CHOICE_SIGNER 4
92 #define WTD_CHOICE_CERT 5
94 typedef struct _WINTRUST_DATA
97 LPVOID pPolicyCallbackData
;
98 LPVOID pSIPClientData
;
100 DWORD fdwRevocationChecks
;
104 struct WINTRUST_FILE_INFO_
* pFile
;
105 struct WINTRUST_CATALOG_INFO_
* pCatalog
;
106 struct WINTRUST_BLOB_INFO_
* pBlob
;
107 struct WINTRUST_SGNR_INFO_
* pSgnr
;
108 struct WINTRUST_CERT_INFO_
* pCert
;
112 HANDLE hWVTStateData
;
113 WCHAR
* pwszURLReference
;
116 } WINTRUST_DATA
, *PWINTRUST_DATA
;
118 typedef struct _CRYPT_TRUST_REG_ENTRY
122 WCHAR
*pwszFunctionName
;
123 } CRYPT_TRUST_REG_ENTRY
, *PCRYPT_TRUST_REG_ENTRY
;
125 typedef struct _CRYPT_REGISTER_ACTIONID
128 CRYPT_TRUST_REG_ENTRY sInitProvider
;
129 CRYPT_TRUST_REG_ENTRY sObjectProvider
;
130 CRYPT_TRUST_REG_ENTRY sSignatureProvider
;
131 CRYPT_TRUST_REG_ENTRY sCertificateProvider
;
132 CRYPT_TRUST_REG_ENTRY sCertificatePolicyProvider
;
133 CRYPT_TRUST_REG_ENTRY sFinalPolicyProvider
;
134 CRYPT_TRUST_REG_ENTRY sTestPolicyProvider
;
135 CRYPT_TRUST_REG_ENTRY sCleanupProvider
;
136 } CRYPT_REGISTER_ACTIONID
, *PCRYPT_REGISTER_ACTIONID
;
138 typedef struct _CRYPT_PROVUI_DATA
{
141 WCHAR
*pYesButtonText
;
142 WCHAR
*pNoButtonText
;
143 WCHAR
*pMoreInfoButtonText
;
144 WCHAR
*pAdvancedLinkText
;
145 WCHAR
*pCopyActionText
;
146 WCHAR
*pCopyActionTextNoTS
;
147 WCHAR
*pCopyActionTextNotSigned
;
148 } CRYPT_PROVUI_DATA
, *PCRYPT_PROVUI_DATA
;
150 typedef struct _CRYPT_PROVIDER_CERT
{
152 PCCERT_CONTEXT pCert
;
157 DWORD dwRevokedReason
;
160 CTL_CONTEXT
*pTrustListContext
;
161 BOOL fTrustListSignerCert
;
162 PCCTL_CONTEXT pCtlContext
;
165 PCERT_CHAIN_ELEMENT pChainElement
;
166 } CRYPT_PROVIDER_CERT
, *PCRYPT_PROVIDER_CERT
;
168 typedef struct _CRYPT_PROVIDER_SGNR
{
170 FILETIME sftVerifyAsOf
;
172 CRYPT_PROVIDER_CERT
*pasCertChain
;
174 CMSG_SIGNER_INFO
*psSigner
;
176 DWORD csCounterSigners
;
177 struct _CRYPT_PROVIDER_SGNR
*pasCounterSigners
;
178 PCCERT_CHAIN_CONTEXT pChainContext
;
179 } CRYPT_PROVIDER_SGNR
, *PCRYPT_PROVIDER_SGNR
;
181 typedef struct _CRYPT_PROVIDER_PRIVDATA
{
186 } CRYPT_PROVIDER_PRIVDATA
, *PCRYPT_PROVIDER_PRIVDATA
;
188 struct _CRYPT_PROVIDER_DATA
;
190 typedef void * (*PFN_CPD_MEM_ALLOC
)(DWORD cbSize
);
191 typedef void (*PFN_CPD_MEM_FREE
)(void *pvMem2Free
);
192 typedef BOOL (*PFN_CPD_ADD_STORE
)(struct _CRYPT_PROVIDER_DATA
*pProvData
,
193 HCERTSTORE hStore2Add
);
194 typedef BOOL (*PFN_CPD_ADD_SGNR
)(struct _CRYPT_PROVIDER_DATA
*pProvData
,
195 BOOL fCounterSigner
, DWORD idxSigner
, struct _CRYPT_PROVIDER_SGNR
*pSgnr2Add
);
196 typedef BOOL (*PFN_CPD_ADD_CERT
)(struct _CRYPT_PROVIDER_DATA
*pProvData
,
197 DWORD idxSigner
, BOOL fCounterSigner
, DWORD idxCounterSigner
,
198 PCCERT_CONTEXT pCert2Add
);
199 typedef BOOL (*PFN_CPD_ADD_PRIVDATA
)(struct _CRYPT_PROVIDER_DATA
*pProvData
,
200 struct _CRYPT_PROVIDER_PRIVDATA
*pPrivData2Add
);
201 typedef HRESULT (*PFN_PROVIDER_INIT_CALL
)(
202 struct _CRYPT_PROVIDER_DATA
*pProvData
);
203 typedef HRESULT (*PFN_PROVIDER_OBJTRUST_CALL
)(
204 struct _CRYPT_PROVIDER_DATA
*pProvData
);
205 typedef HRESULT (*PFN_PROVIDER_SIGTRUST_CALL
)(
206 struct _CRYPT_PROVIDER_DATA
*pProvData
);
207 typedef HRESULT (*PFN_PROVIDER_CERTTTRUST_CALL
)(
208 struct _CRYPT_PROVIDER_DATA
*pProvData
);
209 typedef HRESULT (*PFN_PROVIDER_FINALPOLICY_CALL
)(
210 struct _CRYPT_PROVIDER_DATA
*pProvData
);
211 typedef HRESULT (*PFN_PROVIDER_TESTFINALPOLICY_CALL
)(
212 struct _CRYPT_PROVIDER_DATA
*pProvData
);
213 typedef HRESULT (*PFN_PROVIDER_CLEANUP_CALL
)(
214 struct _CRYPT_PROVIDER_DATA
*pProvData
);
215 typedef BOOL (*PFN_PROVIDER_CERTCHKPOLICY_CALL
)(
216 struct _CRYPT_PROVIDER_DATA
*pProvData
, DWORD idxSigner
,
217 BOOL fCounterSignerChain
, DWORD idxCounterSigner
);
219 typedef struct _CRYPT_PROVIDER_FUNCTIONS
{
221 PFN_CPD_MEM_ALLOC pfnAlloc
;
222 PFN_CPD_MEM_FREE pfnFree
;
223 PFN_CPD_ADD_STORE pfnAddStore2Chain
;
224 PFN_CPD_ADD_SGNR pfnAddSgnr2Chain
;
225 PFN_CPD_ADD_CERT pfnAddCert2Chain
;
226 PFN_CPD_ADD_PRIVDATA pfnAddPrivData2Chain
;
227 PFN_PROVIDER_INIT_CALL pfnInitialize
;
228 PFN_PROVIDER_OBJTRUST_CALL pfnObjectTrust
;
229 PFN_PROVIDER_SIGTRUST_CALL pfnSignatureTrust
;
230 PFN_PROVIDER_CERTTTRUST_CALL pfnCertificateTrust
;
231 PFN_PROVIDER_FINALPOLICY_CALL pfnFinalPolicy
;
232 PFN_PROVIDER_CERTCHKPOLICY_CALL pfnCertCheckPolicy
;
233 PFN_PROVIDER_TESTFINALPOLICY_CALL pfnTestFinalPolicy
;
234 struct _CRYPT_PROVUI_FUNCS
*psUIpfns
;
235 PFN_PROVIDER_CLEANUP_CALL pfnCleanupPolicy
;
236 } CRYPT_PROVIDER_FUNCTIONS
, *PCRYPT_PROVIDER_FUNCTIONS
;
238 struct SIP_DISPATCH_INFO_
;
239 struct SIP_SUBJECTINFO_
;
240 struct SIP_INDIRECT_DATA_
;
242 typedef struct _PROVDATA_SIP
{
245 struct SIP_DISPATCH_INFO_
*pSip
;
246 struct SIP_DISPATCH_INFO_
*pCATSip
;
247 struct SIP_SUBJECTINFO_
*psSipSubjectInfo
;
248 struct SIP_SUBJECTINFO_
*psSipCATSubjectInfo
;
249 struct SIP_INDIRECT_DATA_
*psIndirectData
;
250 } PROVDATA_SIP
, *PPROVDATA_SIP
;
252 typedef struct _CRYPT_PROVIDER_DATA
{
254 WINTRUST_DATA
*pWintrustData
;
260 DWORD dwRegSecuritySettings
;
261 DWORD dwRegPolicySettings
;
262 CRYPT_PROVIDER_FUNCTIONS
*psPfns
;
263 DWORD cdwTrustStepErrors
;
264 DWORD
*padwTrustStepErrors
;
266 HCERTSTORE
*pahStores
;
270 CRYPT_PROVIDER_SGNR
*pasSigners
;
271 DWORD dwSubjectChoice
;
273 struct _PROVDATA_SIP
*pPDSip
;
276 BOOL fRecallWithState
;
277 FILETIME sftSystemTime
;
278 char *pszCTLSignerUsageOID
;
281 PCERT_USAGE_MATCH pRequestUsage
;
282 DWORD dwTrustPubSettings
;
283 DWORD dwUIStateFlags
;
284 } CRYPT_PROVIDER_DATA
, *PCRYPT_PROVIDER_DATA
;
286 typedef BOOL (*PFN_PROVUI_CALL
)(HWND hWndSecurityDialog
,
287 struct _CRYPT_PROVIDER_DATA
*pProvData
);
289 typedef struct _CRYPT_PROVUI_FUNCS
{
291 CRYPT_PROVUI_DATA psUIData
;
292 PFN_PROVUI_CALL pfnOnMoreInfoClick
;
293 PFN_PROVUI_CALL pfnOnMoreInfoClickDefault
;
294 PFN_PROVUI_CALL pfnOnAdvancedClick
;
295 PFN_PROVUI_CALL pfnOnAdvancedClickDefault
;
296 } CRYPT_PROVUI_FUNCS
, *PCRYPT_PROVUI_FUNCS
;
305 BOOL WINAPI
WintrustAddActionID(GUID
*,DWORD
,CRYPT_REGISTER_ACTIONID
*);
306 BOOL WINAPI
WintrustRemoveActionID(GUID
*);
307 BOOL WINAPI
WintrustLoadFunctionPointers(GUID
*,CRYPT_PROVIDER_FUNCTIONS
*);
308 void WINAPI
WintrustGetRegPolicyFlags(DWORD
*);
309 LONG WINAPI
WinVerifyTrust(HWND
,GUID
*,WINTRUST_DATA
*);
310 HRESULT WINAPI
WinVerifyTrustEx(HWND
,GUID
*,WINTRUST_DATA
*);
312 CRYPT_PROVIDER_SGNR
* WINAPI
WTHelperGetProvSignerFromChain(
313 CRYPT_PROVIDER_DATA
*pProvData
, DWORD idxSigner
, BOOL fCounterSigner
,
314 DWORD idxCounterSigner
);
315 CRYPT_PROVIDER_DATA
* WINAPI
WTHelperProvDataFromStateData(HANDLE hStateData
);