csp.cpp
资源名称:pkcs11.rar [点击查看]
上传用户:filter2008
上传日期:2013-02-01
资源大小:101k
文件大小:21k
源码类别:
CA认证
开发平台:
C/C++
- /****************************************************************************
- * library : pkcs_csp.dll
- * Purpose : It is a cryptographic service provider which is an independent
- * software module that actually performs cryptography algorithms for
- * authentication, encoding, and encryption.
- * This DLL can be interfaced on any PKCS#11 module.
- *
- * Copyright (C) 2003 Ilex Syst鑝es Informatiques
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Contact :
- * Ilex
- * 51 boulevard Voltaire
- * 92600 Asni鑢es-sur-Seine
- * pkizy@ilex.fr
- *
- * Author: Delouvrier Antoine
- *
- *******************************************************************************/
- /*
- %----------------------------------------------------------------------------
- % PROJECT : CSP_PKCS
- %
- % MODULE : csp
- %
- % VERSION : 1.00
- %
- % FILE : csp.cpp
- %
- % Entrance points of the DLL: all the entrance points are redirected towards handlecontainer which manages a container
- %----------------------------------------------------------------------------
- % Version 1.00
- %
- % CPX-31/03/2003-Creation
- %----------------------------------------------------------------------------
- % The PKCS#11 module must be defined in the csp_pkcs.ini as below :
- % [CSP_PKCS]
- % Name=name of pkcs#11 module
- %
- %----------------------------------------------------------------------------
- % You can register the csp in Windows thanks to samples which one can find in
- % the CSPDK which is downloadable at the adress :
- % http://www.microsoft.com/downloads/details.aspx?FamilyId=0F436C75-2304-42BB-B81A-BA0C2C47BAC2&displaylang=en
- %
- */
- #ifndef WIN32_LEAN_AND_MEAN
- #define WIN32_LEAN_AND_MEAN
- #endif
- /*
- % HEADER Files include
- %-----------------------
- */
- #include "handlecontainer.h"
- #include "csp_pkcs_const.h"
- #include "resource.h"
- /*
- %Declaration of the private static variables
- %-------------------------------------------
- */
- extern "C" HINSTANCE g_hModule = NULL;
- extern bool already_initialized=false;
- extern int pkcsInitialized=0;
- /*
- %--------------------------------------------------------------------------
- % DllMain
- %
- % Main of the dll
- %--------------------------------------------------------------------------
- */
- BOOL WINAPI
- DllMain(
- HINSTANCE hinstanceDLL,
- DWORD ulRaison,
- LPVOID lpvReserve)
- {
- if (ulRaison == DLL_PROCESS_ATTACH)
- {
- setTraceLevel();
- TRACE(__LINE__,"DLL_PROCESS_ATTACH",NULL);
- DisableThreadLibraryCalls(hinstanceDLL);
- g_hModule = hinstanceDLL;
- }
- return TRUE;
- }
- /*------------------------------------------------------------------------*/
- /*
- Each of these functions can be found in MSDN. Please refer there
- for additional information.
- */
- /*------------------------------------------------------------------------
- CPAcquireContext
- -------------------------------------------------------------------------*/
- BOOL WINAPI
- CPAcquireContext(
- OUT HCRYPTPROV *phProv,
- IN CHAR *pszContainer,
- IN DWORD dwFlags,
- IN PVTableProvStruc pVTable)
- {
- BOOL rv=TRUE;
- TRACE(__LINE__,"CPAcquireContext BEGIN :%d %s %d %d",phProv,pszContainer,dwFlags,pVTable);
- rv=Pkcs::Initialize();
- if(rv!=TRUE)
- return FALSE;
- if (((dwFlags & CRYPT_VERIFYCONTEXT) == CRYPT_VERIFYCONTEXT) &&
- (NULL != pszContainer) && (0 != *pszContainer))
- {
- SetLastError((DWORD) NTE_BAD_FLAGS);
- TRACE(__LINE__,"CPAcquireContext ERROR :%d %s %d %d",phProv,pszContainer,dwFlags,pVTable);
- return FALSE;
- }
- const CHAR * pszFinalContainer;
- if(!pszContainer || (0 == *pszContainer))
- pszFinalContainer = DEFAULT_CONTAINER;
- else
- pszFinalContainer =pszContainer;
- HandleContainer* pHandleContainer = new HandleContainer();
- if(!pHandleContainer){
- TRACE(__LINE__,"CPAcquireContext ERROR :%d %s %d %d",phProv,pszContainer,dwFlags,pVTable);
- return FALSE;
- }
- if(!pHandleContainer->CreateHandleContainer(pszFinalContainer, dwFlags, pVTable))
- {
- delete pHandleContainer;
- TRACE(__LINE__,"CPAcquireContext ERROR :%d %s %d %d",phProv,pszContainer,dwFlags,pVTable);
- return FALSE;
- }
- if((dwFlags & CRYPT_DELETEKEYSET) == CRYPT_DELETEKEYSET)
- delete pHandleContainer;
- else
- *phProv = (HCRYPTPROV)pHandleContainer;
- TRACE(__LINE__,"CPAcquireContext TRUE :%d %s %d %d",phProv,pszContainer,dwFlags,pVTable);
- return TRUE;
- }
- /*------------------------------------------------------------------------
- CPReleaseContext
- -------------------------------------------------------------------------*/
- BOOL WINAPI
- CPReleaseContext(
- IN HCRYPTPROV hProv,
- IN DWORD ulFlags)
- {
- TRACE(__LINE__,"CPReleaseContext : %d, %d",hProv,ulFlags);
- if(!HandleContainer::VerifyHandleContainer((HandleContainer*)hProv))
- {
- TRACE(__LINE__,"CPReleaseContext ERROR: %d, %d",hProv,ulFlags);
- SetLastError(NTE_BAD_UID);
- return FALSE;
- }
- delete (HandleContainer*)hProv;
- Pkcs::FreePkcs();
- TRACE(__LINE__,"CPReleaseContext TRUE: %d, %d",hProv,ulFlags);
- return TRUE;
- }
- /*------------------------------------------------------------------------
- CPGenKey
- -------------------------------------------------------------------------*/
- BOOL WINAPI
- CPGenKey(
- IN HCRYPTPROV hProv,
- IN ALG_ID uiAlgid,
- IN DWORD ulFlags,
- OUT HCRYPTKEY *phKey)
- {
- TRACE(__LINE__,"CPGenKey NOT IMPLEMENTED",NULL);
- SetLastError(E_NOTIMPL);
- return FALSE;
- }
- /*------------------------------------------------------------------------
- CPDeriveKey
- -------------------------------------------------------------------------*/
- BOOL WINAPI
- CPDeriveKey(
- IN HCRYPTPROV hProv,
- IN ALG_ID Algid,
- IN HCRYPTHASH hHash,
- IN DWORD dwFlags,
- OUT HCRYPTKEY *phKey)
- {
- TRACE(__LINE__,"CPDeriveKey NOT IMPLEMENTED",NULL);
- SetLastError(E_NOTIMPL);
- return FALSE;
- }
- /*------------------------------------------------------------------------
- CPDestroyKey
- -------------------------------------------------------------------------*/
- BOOL WINAPI
- CPDestroyKey(
- IN HCRYPTPROV hProv,
- IN HCRYPTKEY hKey)
- {
- TRACE(__LINE__,"CPDestroyKey NOT IMPLEMENTED",NULL);
- return CryptDestroyKey(hKey);
- }
- /*------------------------------------------------------------------------
- CPSetKeyParam
- -------------------------------------------------------------------------*/
- BOOL WINAPI
- CPSetKeyParam(
- IN HCRYPTPROV hProv,
- IN HCRYPTKEY hKey,
- IN DWORD ulParametre,
- IN CONST BYTE *pucData,
- IN DWORD ulFlags)
- {
- BOOL result;
- TRACE(__LINE__,"CPSetKeyParam BEGIN: %d %d %x %d %d",hProv,hKey,ulParametre,pucData,ulFlags);
- if(!HandleContainer::VerifyHandleContainer((HandleContainer*)hProv))
- {
- SetLastError(NTE_BAD_UID);
- TRACE(__LINE__,"CPSetKeyParam ERROR: %d %d %x %d %d",hProv,hKey,ulParametre,pucData,ulFlags);
- return FALSE;
- }
- result=((HandleContainer*)hProv)->SetKeyParam(hKey, ulParametre, pucData, ulFlags);
- if(!result)
- {
- TRACE(__LINE__,"CPSetKeyParam ERROR: %d %d %x %d %d",hProv,hKey,ulParametre,pucData,ulFlags);
- return FALSE;
- }
- TRACE(__LINE__,"CPSetKeyParam TRUE: %d %d %x %d %d",hProv,hKey,ulParametre,pucData,ulFlags);
- return TRUE;
- }
- /*------------------------------------------------------------------------
- CPGetKeyParam
- -------------------------------------------------------------------------*/
- BOOL WINAPI
- CPGetKeyParam(
- IN HCRYPTPROV hProv,
- IN HCRYPTKEY hKey,
- IN DWORD ulParametre,
- OUT LPBYTE pucData,
- IN OUT LPDWORD pulDataLen,
- IN DWORD ulFlags)
- {
- BOOL result;
- TRACE(__LINE__,"CPGetKeyParam BEGIN :%d %d %d %d %d %d",hProv,hKey,ulParametre,pucData,pulDataLen,ulFlags);
- if(!HandleContainer::VerifyHandleContainer((HandleContainer*)hProv))
- {
- SetLastError(NTE_BAD_UID);
- TRACE(__LINE__,"CPGetKeyParam ERROR :%d %d %d %d %d %d",hProv,hKey,ulParametre,pucData,pulDataLen,ulFlags);
- return FALSE;
- }
- result= ((HandleContainer*)hProv)->GetKeyParam(hKey, ulParametre, pucData, pulDataLen, ulFlags);
- if(!result)
- {
- TRACE(__LINE__,"CPGetKeyParam ERROR :%d %d %d %d %d %d",hProv,hKey,ulParametre,pucData,pulDataLen,ulFlags);
- return FALSE;
- }
- TRACE(__LINE__,"CPGetKeyParam TRUE :%d %d %d %d %d %d",hProv,hKey,ulParametre,pucData,pulDataLen,ulFlags);
- return TRUE;
- }
- /*------------------------------------------------------------------------
- CPSetProvParam
- -------------------------------------------------------------------------*/
- BOOL WINAPI
- CPSetProvParam(
- IN HCRYPTPROV hProv,
- IN DWORD ulParametre,
- IN CONST BYTE *pucData,
- IN DWORD ulFlags)
- {
- TRACE(__LINE__,"CPSetProvParam NOT IMPLEMENTED",NULL);
- SetLastError(E_NOTIMPL);
- return FALSE;
- }
- /*------------------------------------------------------------------------
- CPGetProvParam
- -------------------------------------------------------------------------*/
- BOOL WINAPI
- CPGetProvParam(
- IN HCRYPTPROV hProv,
- IN DWORD ulParametre,
- OUT LPBYTE pucData,
- IN OUT LPDWORD pulDataLen,
- IN DWORD ulFlags)
- {
- TRACE(__LINE__,"CPGetProvParam BEGIN :%d,%d;%d,%d,%d",hProv,ulParametre,pucData,pulDataLen,ulFlags);
- if(!HandleContainer::VerifyHandleContainer((HandleContainer*)hProv))
- {
- SetLastError(NTE_BAD_UID);
- TRACE(__LINE__,"CPGetProvParam ERROR :%d,%d;%d,%d,%d",hProv,ulParametre,pucData,pulDataLen,ulFlags);
- return FALSE;
- }
- TRACE(__LINE__,"CPGetProvParam TRUE :%d,%d;%d,%d,%d",hProv,ulParametre,pucData,pulDataLen,ulFlags);
- return ((HandleContainer*)hProv)->GetProvParam(ulParametre, pucData, pulDataLen, ulFlags);
- }
- /*------------------------------------------------------------------------
- CPSetHashParam
- -------------------------------------------------------------------------*/
- BOOL WINAPI
- CPSetHashParam(
- IN HCRYPTPROV hProv,
- IN HCRYPTHASH hHash,
- IN DWORD ulParametre,
- IN BYTE *pucData,
- IN DWORD ulFlags)
- {
- TRACE(__LINE__,"CPSetHashParam BEGIN : %d %d %d %d %d",hProv,hHash,ulParametre,pucData,ulFlags);
- if(!HandleContainer::VerifyHandleContainer((HandleContainer*)hProv))
- {
- SetLastError(NTE_BAD_UID);
- TRACE(__LINE__,"CPSetHashParam ERROR : %d %d %d %d %d",hProv,hHash,ulParametre,pucData,ulFlags);
- return FALSE;
- }
- TRACE(__LINE__,"CPSetHashParam TRUE : %d %d %d %d %d",hProv,hHash,ulParametre,pucData,ulFlags);
- return ((HandleContainer*)hProv)->SetHashParam(hHash, ulParametre, pucData, ulFlags);
- }
- /*------------------------------------------------------------------------
- CPGetHashParam
- -------------------------------------------------------------------------*/
- BOOL WINAPI
- CPGetHashParam(
- IN HCRYPTPROV hProv,
- IN HCRYPTHASH hHash,
- IN DWORD ulParametre,
- OUT LPBYTE pucData,
- IN OUT LPDWORD pulDataLen,
- IN DWORD ulFlags)
- {
- TRACE(__LINE__,"CPSetHashParam BEGIN : %d %d %d %d %d %d",hProv,hHash,ulParametre,pucData,pulDataLen,ulFlags);
- if(!HandleContainer::VerifyHandleContainer((HandleContainer*)hProv))
- {
- SetLastError(NTE_BAD_UID);
- TRACE(__LINE__,"CPSetHashParam ERROR : %d %d %d %d %d %d",hProv,hHash,ulParametre,pucData,pulDataLen,ulFlags);
- return FALSE;
- }
- TRACE(__LINE__,"CPSetHashParam TRUE : %d %d %d %d %d %d",hProv,hHash,ulParametre,pucData,pulDataLen,ulFlags);
- return ((HandleContainer*)hProv)->GetHashParam(hHash, ulParametre, pucData, pulDataLen, ulFlags);
- }
- /*------------------------------------------------------------------------
- CPExportKey
- -------------------------------------------------------------------------*/
- BOOL WINAPI
- CPExportKey(
- IN HCRYPTPROV hProv,
- IN HCRYPTKEY hKey,
- IN HCRYPTKEY hPubKey,
- IN DWORD ulBlobType,
- IN DWORD ulFlags,
- OUT LPBYTE pucData,
- IN OUT LPDWORD pulDataLen)
- {
- TRACE(__LINE__,"CPExportKey NOT IMPLEMENTED",NULL);
- SetLastError(E_NOTIMPL);
- return FALSE;
- }
- /*------------------------------------------------------------------------
- CPImportKey
- -------------------------------------------------------------------------*/
- BOOL WINAPI
- CPImportKey(
- IN HCRYPTPROV hProv,
- IN CONST BYTE *pucData,
- IN DWORD pulDataLen,
- IN HCRYPTKEY hPubKey,
- IN DWORD ulFlags,
- OUT HCRYPTKEY *phKey)
- {
- TRACE(__LINE__,"CPImportKey BEGIN : %d %d %d %d %d %d",hProv,pucData,pulDataLen,hPubKey,ulFlags,phKey);
- if(!HandleContainer::VerifyHandleContainer((HandleContainer*)hProv))
- {
- SetLastError(NTE_BAD_UID);
- TRACE(__LINE__,"CPImportKey ERROR : %d %d %d %d %d %d",hProv,pucData,pulDataLen,hPubKey,ulFlags,phKey);
- return FALSE;
- }
- //
- TRACE(__LINE__,"CPImportKey TRUE : %d %d %d %d %d %d",hProv,pucData,pulDataLen,hPubKey,ulFlags,phKey);
- return ((HandleContainer*)hProv)->ImportKey((unsigned char * )pucData, pulDataLen, hPubKey, ulFlags, phKey);
- }
- /*------------------------------------------------------------------------
- CPEncrypt
- -------------------------------------------------------------------------*/
- BOOL WINAPI
- CPEncrypt(
- IN HCRYPTPROV hProv,
- IN HCRYPTKEY hKey,
- IN HCRYPTHASH hHash,
- IN BOOL fFinal,
- IN DWORD dwFlags,
- IN OUT LPBYTE pbData,
- IN OUT LPDWORD pcbDataLen,
- IN DWORD cbBufLen)
- {
- TRACE(__LINE__,"CPEncrypt BEGIN : %d %d %d %d %d %d %d %d",hProv,hKey,hHash,fFinal,dwFlags,pbData,pcbDataLen,cbBufLen );
- if(!HandleContainer::VerifyHandleContainer((HandleContainer*)hProv))
- {
- SetLastError(NTE_BAD_UID);
- TRACE(__LINE__,"CPEncrypt ERROR: %d %d %d %d %d %d %d %d",hProv,hKey,hHash,fFinal,dwFlags,pbData,pcbDataLen,cbBufLen );
- return FALSE;
- }
- TRACE(__LINE__,"CPEncrypt TRUE : %d %d %d %d %d %d %d %d",hProv,hKey,hHash,fFinal,dwFlags,pbData,pcbDataLen,cbBufLen );
- return ((HandleContainer*)hProv)->Encrypt(hKey, hHash, fFinal, dwFlags, pbData, pcbDataLen, cbBufLen);
- }
- /*------------------------------------------------------------------------
- CPDecrypt
- -------------------------------------------------------------------------*/
- BOOL WINAPI
- CPDecrypt(
- IN HCRYPTPROV hProv,
- IN HCRYPTKEY hKey,
- IN HCRYPTHASH hHash,
- IN BOOL fFinal,
- IN DWORD dwFlags,
- IN OUT LPBYTE pbData,
- IN OUT LPDWORD pcbDataLen)
- {
- BOOL result;
- LPBYTE pbKeyMaterial = NULL;
- TRACE(__LINE__,"CPDecrypt BEGIN : %d %d %d %d %d %d %d",hProv,hKey,hHash,fFinal,dwFlags,pbData,pcbDataLen);
- if(!HandleContainer::VerifyHandleContainer((HandleContainer*)hProv))
- {
- SetLastError(NTE_BAD_UID);
- TRACE(__LINE__,"CPDecrypt ERROR : %d %d %d %d %d %d %d",hProv,hKey,hHash,fFinal,dwFlags,pbData,pcbDataLen);
- return FALSE;
- }
- result=((HandleContainer*)hProv)->Decrypt(hKey, hHash, fFinal, dwFlags, pbData, pcbDataLen);
- if(!result)
- {
- TRACE(__LINE__,"CPDecrypt ERROR : %d %d %d %d %d %d %d error:%xn",hProv,hKey,hHash,fFinal,dwFlags,pbData,pcbDataLen,GetLastError());
- return FALSE;
- }
- TRACE(__LINE__,"CPDecrypt TRUE : %d %d %d %d %d %d %d",hProv,hKey,hHash,fFinal,dwFlags,pbData,pcbDataLen);
- return TRUE;
- }
- /*------------------------------------------------------------------------
- CPCreateHash
- -------------------------------------------------------------------------*/
- BOOL WINAPI
- CPCreateHash(
- IN HCRYPTPROV hProv,
- IN ALG_ID Algid,
- IN HCRYPTKEY hKey,
- IN DWORD dwFlags,
- OUT HCRYPTHASH *phHash)
- {
- TRACE(__LINE__,"CPCreateHash BEGIN :%d %d %d %d %d",hProv,Algid,hKey,dwFlags,phHash);
- if(!HandleContainer::VerifyHandleContainer((HandleContainer*)hProv))
- {
- SetLastError(NTE_BAD_UID);
- TRACE(__LINE__,"CPCreateHash ERROR :%d %d %d %d %d",hProv,Algid,hKey,dwFlags,phHash);
- return FALSE;
- }
- TRACE(__LINE__,"CPCreateHash TRUE :%d %d %d %d %d",hProv,Algid,hKey,dwFlags,phHash);
- return ((HandleContainer*)hProv)->CreateHash(Algid, hKey, dwFlags, phHash);
- }
- /*------------------------------------------------------------------------
- CPHashData
- -------------------------------------------------------------------------*/
- BOOL WINAPI
- CPHashData(
- IN HCRYPTPROV hProv,
- IN HCRYPTHASH hHash,
- IN CONST BYTE *pbData,
- IN DWORD cbDataLen,
- IN DWORD dwFlags)
- {
- TRACE(__LINE__,"CPHashData BEGIN : %d %d %d %d %d",hProv,hHash,pbData,cbDataLen,dwFlags);
- if(!HandleContainer::VerifyHandleContainer((HandleContainer*)hProv))
- {
- SetLastError(NTE_BAD_UID);
- TRACE(__LINE__,"CPHashData ERROR : %d %d %d %d %d",hProv,hHash,pbData,cbDataLen,dwFlags);
- return FALSE;
- }
- TRACE(__LINE__,"CPHashData TRUE : %d %d %d %d %d",hProv,hHash,pbData,cbDataLen,dwFlags);
- return ((HandleContainer*)hProv)->HashData(hHash, pbData, cbDataLen, dwFlags);
- }
- /*------------------------------------------------------------------------
- CPHashSessionKey
- -------------------------------------------------------------------------*/
- BOOL WINAPI
- CPHashSessionKey(
- IN HCRYPTPROV hProv,
- IN HCRYPTHASH hHash,
- IN HCRYPTKEY hKey,
- IN DWORD dwFlags)
- {
- TRACE(__LINE__,"CPHashSessionKey NOT IMPLEMENTED",NULL);
- SetLastError(E_NOTIMPL);
- return FALSE;
- }
- /*------------------------------------------------------------------------
- CPSignHash
- -------------------------------------------------------------------------*/
- BOOL WINAPI
- CPSignHash(
- IN HCRYPTPROV hProv,
- IN HCRYPTHASH hHash,
- IN DWORD dwKeySpec,
- IN LPCWSTR szDescription,
- IN DWORD dwFlags,
- OUT LPBYTE pbSignature,
- IN OUT LPDWORD pcbSigLen)
- {
- TRACE(__LINE__,"CPSignHash BEGIN : %d %d %d %d %d %d %d",hProv,hHash,dwKeySpec,szDescription,dwFlags,pbSignature,pcbSigLen);
- if(!HandleContainer::VerifyHandleContainer((HandleContainer*)hProv))
- {
- SetLastError(NTE_BAD_UID);
- TRACE(__LINE__,"CPSignHash ERROR : %d %d %d %d %d %d %d",hProv,hHash,dwKeySpec,szDescription,dwFlags,pbSignature,pcbSigLen);
- return FALSE;
- }
- TRACE(__LINE__,"CPSignHash TRUE : %d %d %d %d %d %d %d",hProv,hHash,dwKeySpec,szDescription,dwFlags,pbSignature,pcbSigLen);
- return ((HandleContainer*)hProv)->SignHash(hHash,dwKeySpec,szDescription,dwFlags,pbSignature, pcbSigLen);
- }
- /*------------------------------------------------------------------------
- CPDestroyHash
- -------------------------------------------------------------------------*/
- BOOL WINAPI
- CPDestroyHash(
- IN HCRYPTPROV hProv,
- IN HCRYPTHASH hHash)
- {
- TRACE(__LINE__,"CPDestryHash BEGIN : %d %d",hProv,hHash);
- if(!HandleContainer::VerifyHandleContainer((HandleContainer*)hProv))
- {
- SetLastError(NTE_BAD_UID);
- TRACE(__LINE__,"CPDestryHash ERROR : %d %d",hProv,hHash);
- return FALSE;
- }
- TRACE(__LINE__,"CPDestryHash TRUE : %d %d",hProv,hHash);
- return ((HandleContainer*)hProv)->DestroyHash(hHash);
- }
- /*------------------------------------------------------------------------
- CPVerifySignature
- -------------------------------------------------------------------------*/
- BOOL WINAPI
- CPVerifySignature(
- IN HCRYPTPROV hProv,
- IN HCRYPTHASH hHash,
- IN CONST BYTE *pbSignature,
- IN DWORD cbSigLen,
- IN HCRYPTKEY hPubKey,
- IN LPCTSTR szDescription,
- IN DWORD dwFlags)
- {
- TRACE(__LINE__,"CPVerifySignature BEGIN : %d %d %d %d %d %d %d",hProv,hHash,pbSignature,cbSigLen,hPubKey,szDescription,dwFlags);
- if(!HandleContainer::VerifyHandleContainer((HandleContainer*)hProv))
- {
- SetLastError(NTE_BAD_UID);
- TRACE(__LINE__,"CPVerifySignature ERROR : %d %d %d %d %d %d %d",hProv,hHash,pbSignature,cbSigLen,hPubKey,szDescription,dwFlags);
- return FALSE;
- }
- TRACE(__LINE__,"CPVerifySignature TRUE : %d %d %d %d %d %d %d",hProv,hHash,pbSignature,cbSigLen,hPubKey,szDescription,dwFlags);
- return ((HandleContainer*)hProv)->VerifySignature(hHash, pbSignature, cbSigLen, hPubKey, szDescription, dwFlags);
- }
- /*------------------------------------------------------------------------
- CPGenRandom
- -------------------------------------------------------------------------*/
- BOOL WINAPI
- CPGenRandom(
- IN HCRYPTPROV hProv,
- IN DWORD cbLen,
- OUT LPBYTE pbBuffer)
- {
- TRACE(__LINE__,"CPGenRandom NOT IMPLEMENTED",NULL);
- SetLastError(E_NOTIMPL);
- return FALSE;
- }
- /*------------------------------------------------------------------------
- CPGetUserKey
- -------------------------------------------------------------------------*/
- BOOL WINAPI
- CPGetUserKey(
- IN HCRYPTPROV hProv,
- IN DWORD dwKeySpec,
- OUT HCRYPTKEY *phUserKey)
- {
- TRACE(__LINE__,"CPGetUserKey BEGIN : %d %d %d",hProv,dwKeySpec,phUserKey);
- if(!HandleContainer::VerifyHandleContainer((HandleContainer*)hProv))
- {
- SetLastError(NTE_BAD_UID);
- TRACE(__LINE__,"CPGetUserKey ERROR : %d %d %d",hProv,dwKeySpec,phUserKey);
- return FALSE;
- }
- ((HandleContainer*)hProv)->GetUserKey(dwKeySpec,phUserKey);
- TRACE(__LINE__,"CPGetUserKey TRUE : %d %d %d",hProv,dwKeySpec,phUserKey);
- return TRUE;
- }