大网数据广告活动
账户与安全

CRYPT_VERIFY_IMAGE function pointer (Cspdk.h)

· 52CE 我爱测

Used by a cryptographic service provider (CSP) to verify the signature of a DLL.

The FuncVerifyImage callback function is used by a cryptographic service provider (CSP) to verify the signature of a DLL.

All auxiliary DLLs into which a CSP makes function calls must be signed in the same manner (and with the same key) as the primary CSP DLL. To ensure this signature, the auxiliary DLLs must be loaded dynamically by using the LoadLibrary function. But before the DLL is loaded, the signature of the DLL must be verified. The CSP performs this verification by calling the FuncVerifyImage function, as shown in the example below.

Syntax

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

Parameters

lpszImage [in]

The address of a null-terminated string that contains the path and file name of the DLL to verify the signature for.

pbSigData [in]

The address of a buffer that contains the signature.

Return value

Returns TRUE if the function succeeds, FALSE if it fails.

Examples

The following example shows how to use the FuncVerifyImage callback function to verify the signature of a DLL before it is loaded by a 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.
//...

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Header Cspdk.h

See also

CPAcquireContext

VTableProvStruc

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。