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