Platform SDK: Cryptography |
The VTableProvStruc structure contains pointers to callback functions that can be used by CSP functions.
typedef struct _VTableProvStruc { DWORD Version; FARPROC FuncVerifyImage; FARPROC FuncReturnhWnd; DWORD dwProvType; BYTE *pbContextInfo; DWORD cbContextInfo; LPSTR pszProvName; } VTableProvStruc, *PVTableProvStruc; BOOL FuncVerifyImage(LPCSTR lpszImage, BYTE *pSigData); BOOL FuncReturnhWnd(DWORD *phWnd);
Version 2 is available with Windows 98. The first six members are used. Version 3 is available with Windows 2000. It includes all seven members.
The pointers in the VTableProvStruc structure are only available within the CPAcquireContext function. If members of the structure are needed after a call to CPAcquireContext is completed, copies of the needed structure elements must be made by the CSP. The function pointers in the structure can be copied and the function pointer can be used until the context is released.
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 make this work properly, the auxiliary DLLs must be loaded dynamically, using the LoadLib function. But before LoadLib is called, the signature of the DLL must be verified. The CSP does this verification by calling the FuncVerifyImage function, as illustrated in the following code fragment:
BOOL (FARPROC *ProvVerifyImage)(LPCSTR lpszImage, BYTE *pSigData); BYTE bSignature[72]; // "ProvVerifyImage" has been set to "pVTable->FuncVerifyImage" // within the CPAcquireContext function. // Load the C:\Winnt40\System32\signature.sig file into the // bSignature buffer. During development, this file is created // with the Sign.exe utility. ... // Verify the signature on 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 LoadLib function, then acquire pointers to // the member functions with the GetProcAddress function. ...
Windows NT/2000: Requires Windows NT 4.0 or later.
Windows 95/98: Requires Windows 95 OSR2 or later (or Windows 95 with Internet Explorer 3.02 or later).
Header: Declared in Wincrypt.h.