CRYPT_VERIFY_IMAGE函式指標

FuncVerifyImage回呼函式是由密碼編譯服務提供者使用, (CSP) 來驗證 DLL 的簽章。

CSP 進行函式呼叫的所有輔助 DLL 都必須以相同的方式簽署 (,並使用與主要 CSP DLL 相同的金鑰) 。 若要確保此簽章,必須使用 LoadLibrary 函式動態載入輔助 DLL。 但在載入 DLL 之前,必須驗證 DLL 的簽章。 CSP 會藉由呼叫 FuncVerifyImage 函式來執行此驗證,如下列範例所示。

語法

typedef BOOL ( WINAPI *CRYPT_VERIFY_IMAGE)(
  _In_       LPCTSTR lpszImage,
  _In_ const BYTE    *pbSigData
);

參數

lpszImage [in]

Null 終止字串的位址,其中包含要驗證簽章之 DLL 的路徑和檔案名。

pbSigData [in]

包含簽章的緩衝區位址。

傳回值

如果函式成功,則傳回 TRUE ;如果函式失敗,則傳回 FALSE

範例

下列範例示範如何使用 FuncVerifyImage 回呼函式來驗證 DLL 的簽章,再由 CSP 載入。

BOOL (FARPROC *ProvVerifyImage)(LPCSTR lpszImage, BYTE *pSigData);


//  "ProvVerifyImage" has been set to "pVTable->FuncVerifyImage"
//  within the CPAcquireContext function.

//  bSignature is a previously assigned BYTE array that contains the
//  signature that is stored in the C:\Winnt40\System32\signature.sig
//  file. During development, this file is created with the 
//  Sign.exe tool.
...


//  Verify the signature in the
//  C:\Winnt40\System32\Signature.dll file.
if(RCRYPT_FAILED(ProvVerifyImage
    ("c:\\winnt40\\system32\\signature.dll",
        bSignature)) {
    SetLastError(NTE_BAD_SIGNATURE);
    return CRYPT_FAILED;
}

//  Load the DLL with the LoadLibrary function, then acquire pointers 
//  to the functions with the GetProcAddress function.
//...

規格需求

需求
最低支援的用戶端
Windows XP [僅限傳統型應用程式]
最低支援的伺服器
Windows Server 2003 [僅限傳統型應用程式]
標頭
Cspdk.h

另請參閱

CPAcquireCoNtext

VTableProvStruc