📄 wintrust.h
字号:
//+-------------------------------------------------------------------------
//
// Microsoft Windows
//
// Copyright 1996 - 1998 Microsoft Corporation.
//
// File: wintrust.h
//
// Contents: Microsoft Internet Security Trust Provider Model
//
// History: 31-May-1997 created
//
//--------------------------------------------------------------------------
#ifndef WINTRUST_H
#define WINTRUST_H
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//
// Client definitions, typedefs, and prototypes
//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
#pragma pack(8)
//////////////////////////////////////////////////////////////////////////////
//
// WINTRUST_DATA Structure
//----------------------------------------------------------------------------
// Used when calling WinVerifyTrust to pass necessary information into
// the Providers.
//
typedef struct _WINTRUST_DATA
{
DWORD cbStruct; // = sizeof(WINTRUST_DATA)
LPVOID pPolicyCallbackData; // optional: used to pass data between the app and policy
DWORD dwUIChoice; // required: UI choice. One of the following.
# define WTD_UI_ALL 1
# define WTD_UI_NONE 2
# define WTD_UI_NOBAD 3
# define WTD_UI_NOGOOD 4
DWORD fdwRevocationChecks; // required: certificate revocation check options
# define WTD_REVOKE_NONE 0x00000000
# define WTD_REVOKE_WHOLECHAIN 0x00000001
DWORD dwUnionChoice; // required: which structure is being passed in?
# define WTD_CHOICE_FILE 1
# define WTD_CHOICE_CATALOG 2
# define WTD_CHOICE_BLOB 3
# define WTD_CHOICE_SIGNER 4
# define WTD_CHOICE_CERT 5
union
{
struct WINTRUST_FILE_INFO_ *pFile; // individual file
struct WINTRUST_CATALOG_INFO_ *pCatalog; // member of a Catalog File
struct WINTRUST_BLOB_INFO_ *pBlob; // memory blob
struct WINTRUST_SGNR_INFO_ *pSgnr; // signer structure only
struct WINTRUST_CERT_INFO_ *pCert;
};
DWORD dwStateAction; // future. DO NOT USE!!! (optional)
# define WTD_STATEACTION_OPEN 1
# define WTD_STATEACTION_VERIFY 2
# define WTD_STATEACTION_CLOSE 3
HANDLE hWVTStateData; // future. DO NOT USE!!! (optional)
} WINTRUST_DATA, *PWINTRUST_DATA;
//////////////////////////////////////////////////////////////////////////////
//
// WINTRUST_FILE_INFO Structure
//----------------------------------------------------------------------------
// Used when calling WinVerifyTrust against an individual file.
//
typedef struct WINTRUST_FILE_INFO_
{
DWORD cbStruct; // = sizeof(WINTRUST_FILE_INFO)
LPCWSTR pcwszFilePath; // required, file name to be verified
HANDLE hFile; // optional, open handle to pcwszFilePath
} WINTRUST_FILE_INFO, *PWINTRUST_FILE_INFO;
//////////////////////////////////////////////////////////////////////////////
//
// WINTRUST_CATALOG_INFO Structure
//----------------------------------------------------------------------------
// Used when calling WinVerifyTrust against a member of a Microsoft Catalog
// file.
//
typedef struct WINTRUST_CATALOG_INFO_
{
DWORD cbStruct; // = sizeof(WINTRUST_CATALOG_INFO)
DWORD dwCatalogVersion; // optional: Catalog version number
LPCWSTR pcwszCatalogFilePath; // required: path/name to Catalog file
LPCWSTR pcwszMemberTag; // required: tag to member in Catalog
LPCWSTR pcwszMemberFilePath; // required: path/name to member file
HANDLE hMemberFile; // optional: open handle to pcwszMemberFilePath
} WINTRUST_CATALOG_INFO, *PWINTRUST_CATALOG_INFO;
//////////////////////////////////////////////////////////////////////////////
//
// WINTRUST_BLOB_INFO Structure
//----------------------------------------------------------------------------
// Used when calling WinVerifyTrust against a memory blob.
//
typedef struct WINTRUST_BLOB_INFO_
{
DWORD cbStruct; // = sizeof(WINTRUST_BLOB_INFO)
LPCWSTR pcwszDisplayName; // name of the "thing" the pbMem is pointing to.
DWORD cbMem;
BYTE *pbMem;
} WINTRUST_BLOB_INFO, *PWINTRUST_BLOB_INFO;
//////////////////////////////////////////////////////////////////////////////
//
// WINTRUST_SGNR_INFO Structure
//----------------------------------------------------------------------------
// Used when calling WinVerifyTrust against a CMSG_SIGNER_INFO Structure
//
typedef struct WINTRUST_SGNR_INFO_
{
DWORD cbStruct; // = sizeof(WINTRUST_SGNR_INFO)
LPCWSTR pcwszDisplayName; // name of the "thing" the pbMem is pointing to.
CMSG_SIGNER_INFO *psSignerInfo;
DWORD chStores; // number of stores in pahStores
HCERTSTORE *pahStores; // array of stores to add to internal list
} WINTRUST_SGNR_INFO, *PWINTRUST_SGNR_INFO;
//////////////////////////////////////////////////////////////////////////////
//
// WINTRUST_CERT_INFO Structure
//----------------------------------------------------------------------------
// Used when calling WinVerifyTrust against a CERT_CONTEXT Structure
//
typedef struct WINTRUST_CERT_INFO_
{
DWORD cbStruct; // = sizeof(WINTRUST_CERT_INFO)
LPCWSTR pcwszDisplayName; // name of the "thing" the pbMem is pointing to.
CERT_CONTEXT *psCertContext;
DWORD chStores; // number of stores in pahStores
HCERTSTORE *pahStores; // array of stores to add to internal list
} WINTRUST_CERT_INFO, *PWINTRUST_CERT_INFO;
#pragma pack()
//////////////////////////////////////////////////////////////////////////////
//
// WinVerifyTrust
//----------------------------------------------------------------------------
// Exported from WINTRUST.DLL.
// Call this function to verify the trust based on a digital signer.
//
// Returns:
// ERROR_SUCCESS If the trust is authenticated or
// if the user accepted the risk.
//
// TRUST_E_PROVIDER_UNKNOWN there was an error loading one of the
// required Providers.
//
// all error codes passed back are based on the Policy Provider used.
//
LONG WINAPI WinVerifyTrust(IN OPTIONAL HWND hwnd,
IN GUID *pgActionID,
IN LPVOID pWintrustData);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//
// Trust, Policy, and UI Provider definitions, typedefs, and prototypes
//
// Model:
// A client wishing to validate trust through WinVerifyTrust will
// select an appropriate Action ID guid for the call.
// This guid is defined by each Policy Provider and represents the
// functions called based on the policy for the given object.
//
// In this model, the Policy Provider determines which style of UI
// will be shown to the user (this only applies to style, the
// determination of whether UI is displayed is set by the calling client
// in the UI flags member of WINTRUST_DATA).
//
// Since the function entry points are common (same return value and
// parameters), it allows Policy Provider developers to take advantage
// of existing, generic, code to fill the CRYPT_PROVIDER_DATA structure.
//
// This also allows the developer to simply add the specific policy they
// need, then, call the generic Policy Provider - if appropriate.
//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//
// Supported ASN structures contained in WINTRUST.DLL
//----------------------------------------------------------------------------
//
#pragma pack (8)
#define SPC_INDIRECT_DATA_CONTENT_STRUCT ((LPCSTR)2003)
#define SPC_INDIRECT_DATA_OBJID "1.3.6.1.4.1.311.2.1.4"
#define SPC_GLUE_RDN_OBJID "1.3.6.1.4.1.311.2.1.25"
typedef struct _SPC_INDIRECT_DATA_CONTENT
{
CRYPT_ATTRIBUTE_TYPE_VALUE Data;
CRYPT_ALGORITHM_IDENTIFIER DigestAlgorithm;
CRYPT_HASH_BLOB Digest;
} SPC_INDIRECT_DATA_CONTENT, *PSPC_INDIRECT_DATA_CONTENT;
#pragma pack()
//////////////////////////////////////////////////////////////////////////////
//
// Wintrust Policy Flags
//----------------------------------------------------------------------------
// These are set during install and can be modified by the user
// through various means. The SETREG.EXE utility (found in the Authenticode
// Tools Pack) will select/deselect each of them.
//
#define WTPF_TRUSTTEST 0x00000020 // trust any "TEST" generated certificate
#define WTPF_TESTCANBEVALID 0x00000080
#define WTPF_IGNOREEXPIRATION 0x00000100 // Use expiration date
#define WTPF_IGNOREREVOKATION 0x00000200 // Do revocation check
#define WTPF_OFFLINEOK_IND 0x00000400 // off-line is ok for individual certs
#define WTPF_OFFLINEOK_COM 0x00000800 // off-line is ok for commercial certs
#define WTPF_OFFLINEOKNBU_IND 0x00001000 // off-line is ok for individual certs, no bad ui
#define WTPF_OFFLINEOKNBU_COM 0x00002000 // off-line is ok for commercial certs, no bad ui
#define WTPF_TIMESTAMP_IND 0x00004000 // Use timestamp for individual certs
#define WTPF_TIMESTAMP_COM 0x00008000 // Use timestamp for commerical certs
#define WTPF_VERIFY_V1_OFF 0x00010000 // turn verify of v1 certs off
#define WTPF_IGNOREREVOCATIONONTS 0x00020000 // ignore TimeStamp revocation checks
//////////////////////////////////////////////////////////////////////////////
//
// WintrustGetRegPolicyFlags
//----------------------------------------------------------------------------
// This API call is exported from WINTRUST.DLL and is the recommended method
// of retrieving the DWORD representing the Policy Flags.
//
extern void WINAPI WintrustGetRegPolicyFlags(DWORD *pdwPolicyFlags);
//////////////////////////////////////////////////////////////////////////////
//
// Trust Provider "Step" Error defines
//----------------------------------------------------------------------------
// Each "step" of the Trust process has an error "slot" associated with it.
// If an error occurs, the "step" will assign its result to this "slot". These
// errors can be any valid WINERROR.H HRESULT code.
//
#define TRUSTERROR_STEP_WVTPARAMS 0
#define TRUSTERROR_STEP_FILEIO 2
#define TRUSTERROR_STEP_SIP 3
#define TRUSTERROR_STEP_SIPSUBJINFO 5
#define TRUSTERROR_STEP_CATALOGFILE 6
#define TRUSTERROR_STEP_CERTSTORE 7
#define TRUSTERROR_STEP_MESSAGE 8
#define TRUSTERROR_STEP_MSG_SIGNERCOUNT 9
#define TRUSTERROR_STEP_MSG_INNERCNTTYPE 10
#define TRUSTERROR_STEP_MSG_INNERCNT 11
#define TRUSTERROR_STEP_MSG_STORE 12
#define TRUSTERROR_STEP_MSG_SIGNERINFO 13
#define TRUSTERROR_STEP_MSG_SIGNERCERT 14
#define TRUSTERROR_STEP_MSG_CERTCHAIN 15
#define TRUSTERROR_STEP_MSG_COUNTERSIGINFO 16
#define TRUSTERROR_STEP_MSG_COUNTERSIGCERT 17
#define TRUSTERROR_STEP_VERIFY_MSGHASH 18
#define TRUSTERROR_STEP_VERIFY_MSGINDIRECTDATA 19
#define TRUSTERROR_STEP_FINAL_WVTINIT 30
#define TRUSTERROR_STEP_FINAL_INITPROV 31
#define TRUSTERROR_STEP_FINAL_OBJPROV 32
#define TRUSTERROR_STEP_FINAL_SIGPROV 33
#define TRUSTERROR_STEP_FINAL_CERTPROV 34
#define TRUSTERROR_STEP_FINAL_CERTCHKPROV 35
#define TRUSTERROR_STEP_FINAL_POLICYPROV 36
#define TRUSTERROR_STEP_FINAL_UIPROV 37
#define TRUSTERROR_MAX_STEPS 38
//////////////////////////////////////////////////////////////////////////////
//
// allocation and free function prototypes
//----------------------------------------------------------------------------
//
typedef void *(*PFN_CPD_MEM_ALLOC)(IN DWORD cbSize);
typedef void (*PFN_CPD_MEM_FREE)(IN void *pvMem2Free);
typedef BOOL (*PFN_CPD_ADD_STORE)(IN struct _CRYPT_PROVIDER_DATA *pProvData,
IN HCERTSTORE hStore2Add);
typedef BOOL (*PFN_CPD_ADD_SGNR)(IN struct _CRYPT_PROVIDER_DATA *pProvData,
IN BOOL fCounterSigner,
IN OPTIONAL DWORD idxSigner,
IN struct _CRYPT_PROVIDER_SGNR *pSgnr2Add);
typedef BOOL (*PFN_CPD_ADD_CERT)(IN struct _CRYPT_PROVIDER_DATA *pProvData,
IN DWORD idxSigner,
IN BOOL fCounterSigner,
IN OPTIONAL DWORD idxCounterSigner,
IN PCCERT_CONTEXT pCert2Add);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -