📄 mssip.h
字号:
// CRYPT_E_FILERESIZED: returned when signing a fixed-length
// file (e.g.: CABs) and the message
// is larger than the pre-allocated
// size. The 'put' function will re-
// size the file and return this error.
// The CreateIndirect function MUST be
// called again to recalculate the
// indirect data (hash). Then, call the
// 'put' function again.
//
extern BOOL WINAPI CryptSIPPutSignedDataMsg(
IN SIP_SUBJECTINFO *pSubjectInfo,
IN DWORD dwEncodingType,
OUT DWORD *pdwIndex,
IN DWORD cbSignedDataMsg,
IN BYTE *pbSignedDataMsg);
typedef BOOL (* pCryptSIPPutSignedDataMsg)(
IN SIP_SUBJECTINFO *pSubjectInfo,
IN DWORD dwEncodingType,
OUT DWORD *pdwIndex,
IN DWORD cbSignedDataMsg,
IN BYTE *pbSignedDataMsg);
//////////////////////////////////////////////////////////////////////////////
//
// CryptSIPCreateIndirectData
//----------------------------------------------------------------------------
// Returns a PSIP_INDIRECT_DATA structure filled in the hash, digest alogrithm
// and an encoded attribute. If pcIndirectData points to a DWORD and
// psIndirect data points to null the the size of the data should be returned
// in pcIndirectData.
//
// Returns:
// TRUE: No fatal errors
// FALSE: Errors occured. See GetLastError()
//
// Last Errors:
// NTE_BAD_ALGID: Bad Algorithm Identifyer
// ERROR_NOT_ENOUGH_MEMORY: error allocating memory
// TRUST_E_SUBJECT_FORM_UNKNOWN: unknown subject type.
// ERROR_INVALID_PARAMETER: bad argument passed in
// ERROR_BAD_FORMAT: file/data format is not correct
// for the requested SIP.
//
extern BOOL WINAPI CryptSIPCreateIndirectData(
IN SIP_SUBJECTINFO *pSubjectInfo,
IN OUT DWORD *pcbIndirectData,
OUT SIP_INDIRECT_DATA *pIndirectData);
typedef BOOL (* pCryptSIPCreateIndirectData)(
IN SIP_SUBJECTINFO *pSubjectInfo,
IN OUT DWORD *pcbIndirectData,
OUT SIP_INDIRECT_DATA *pIndirectData);
//////////////////////////////////////////////////////////////////////////////
//
// CryptSIPVerifyIndirectData
//----------------------------------------------------------------------------
// Takes the information stored in the indirect data and compares it to the
// subject.
//
// Returns:
// TRUE: No fatal errors
// FALSE: Errors occured. See GetLastError()
//
// Last Errors:
// NTE_BAD_ALGID: Bad Algorithm Identifyer
// ERROR_NOT_ENOUGH_MEMORY: error allocating memory
// TRUST_E_SUBJECT_FORM_UNKNOWN: unknown subject type.
// CRYPT_E_NO_MATCH: could not find the specified index
// CRYPT_E_SECURITY_SETTINGS: due to security settings, the file
// was not verified.
// ERROR_INVALID_PARAMETER: bad argument passed in
// ERROR_BAD_FORMAT: file/data format is not correct
// for the requested SIP.
extern BOOL WINAPI CryptSIPVerifyIndirectData(
IN SIP_SUBJECTINFO *pSubjectInfo,
IN SIP_INDIRECT_DATA *pIndirectData);
typedef BOOL (* pCryptSIPVerifyIndirectData)(
IN SIP_SUBJECTINFO *pSubjectInfo,
IN SIP_INDIRECT_DATA *pIndirectData);
//////////////////////////////////////////////////////////////////////////////
//
// CryptSIPRemoveSignedDataMsg
//----------------------------------------------------------------------------
// Removes the signature at the specified index
//
// Returns:
// TRUE: No fatal errors
// FALSE: Errors occured. See GetLastError()
//
// Last Errors:
// TRUST_E_SUBJECT_FORM_UNKNOWN: unknown subject type.
// CRYPT_E_NO_MATCH: could not find the specified index
// ERROR_INVALID_PARAMETER: bad argument passed in
// ERROR_BAD_FORMAT: file/data format is not correct
// for the requested SIP.
//
extern BOOL WINAPI CryptSIPRemoveSignedDataMsg(
IN SIP_SUBJECTINFO *pSubjectInfo,
IN DWORD dwIndex);
typedef BOOL (* pCryptSIPRemoveSignedDataMsg)(
IN SIP_SUBJECTINFO *pSubjectInfo,
IN DWORD dwIndex);
#pragma pack(8)
//////////////////////////////////////////////////////////////////////////////
//
// SIP_DISPATCH_INFO
//----------------------------------------------------------------------------
//
typedef struct SIP_DISPATCH_INFO_
{
DWORD cbSize; // = sizeof(SIP_DISPATCH_INFO)
HANDLE hSIP; // used internal
pCryptSIPGetSignedDataMsg pfGet;
pCryptSIPPutSignedDataMsg pfPut;
pCryptSIPCreateIndirectData pfCreate;
pCryptSIPVerifyIndirectData pfVerify;
pCryptSIPRemoveSignedDataMsg pfRemove;
} SIP_DISPATCH_INFO, *LPSIP_DISPATCH_INFO;
//
// the sip exports this function to allow verification and signing
// processes to pass in the file handle and check if the sip supports
// this type of file. if it does, the sip will return TRUE and fill
// out the pgSubject with the appropiate GUID.
//
typedef BOOL (*pfnIsFileSupported)(IN HANDLE hFile,
OUT GUID *pgSubject);
typedef BOOL (*pfnIsFileSupportedName)(IN WCHAR *pwszFileName,
OUT GUID *pgSubject);
typedef struct SIP_ADD_NEWPROVIDER_
{
DWORD cbStruct;
GUID *pgSubject;
WCHAR *pwszDLLFileName;
WCHAR *pwszMagicNumber; // optional
WCHAR *pwszIsFunctionName; // optiona: pfnIsFileSupported
WCHAR *pwszGetFuncName;
WCHAR *pwszPutFuncName;
WCHAR *pwszCreateFuncName;
WCHAR *pwszVerifyFuncName;
WCHAR *pwszRemoveFuncName;
WCHAR *pwszIsFunctionNameFmt2; // optiona: pfnIsFileSupported
} SIP_ADD_NEWPROVIDER, *PSIP_ADD_NEWPROVIDER;
#define SIP_MAX_MAGIC_NUMBER 4
#pragma pack()
//////////////////////////////////////////////////////////////////////////////
//
// CryptLoadSIP
//----------------------------------------------------------------------------
//
// Returns:
// TRUE: No fatal errors
// FALSE: Errors occured. See GetLastError()
//
extern BOOL WINAPI CryptSIPLoad(IN const GUID *pgSubject, // GUID for the requried sip
IN DWORD dwFlags, // Reserved - MUST BE ZERO
IN OUT SIP_DISPATCH_INFO *pSipDispatch); // Table of functions
//////////////////////////////////////////////////////////////////////////////
//
// CryptSIPRetrieveSubjectGuid (defined in crypt32.dll)
//----------------------------------------------------------------------------
// looks at the file's "Magic Number" and tries to determine which
// SIP's object ID is right for the file type.
//
// NOTE: This function only supports the MSSIP32.DLL set of SIPs.
//
// Returns:
// TRUE: No fatal errors
// FALSE: Errors occured. See GetLastError()
//
extern BOOL WINAPI CryptSIPRetrieveSubjectGuid(IN LPCWSTR FileName, // wide file name
IN OPTIONAL HANDLE hFileIn, // or handle of open file
OUT GUID *pgSubject); // defined SIP's GUID
//////////////////////////////////////////////////////////////////////////////
//
// CryptSIPAddProvider
//----------------------------------------------------------------------------
//
// Returns:
// TRUE: No fatal errors
// FALSE: Errors occured. See GetLastError()
//
extern BOOL WINAPI CryptSIPAddProvider(IN SIP_ADD_NEWPROVIDER *psNewProv);
//////////////////////////////////////////////////////////////////////////////
//
// CryptSIPRemoveProvider
//----------------------------------------------------------------------------
//
// Returns:
// TRUE: No fatal errors
// FALSE: Errors occured. See GetLastError()
//
extern BOOL WINAPI CryptSIPRemoveProvider(IN GUID *pgProv);
#ifdef __cplusplus
}
#endif
#endif // MSSIP_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -