- Visual C++源码
- Visual Basic源码
- C++ Builder源码
- Java源码
- Delphi源码
- C/C++源码
- PHP源码
- Perl源码
- Python源码
- Asm源码
- Pascal源码
- Borland C++源码
- Others源码
- SQL源码
- VBScript源码
- JavaScript源码
- ASP/ASPX源码
- C#源码
- Flash/ActionScript源码
- matlab源码
- PowerBuilder源码
- LabView源码
- Flex源码
- MathCAD源码
- VBA源码
- IDL源码
- Lisp/Scheme源码
- VHDL源码
- Objective-C源码
- Fortran源码
- tcl/tk源码
- QT源码
handlecontainer.h
资源名称:pkcs11.rar [点击查看]
上传用户:filter2008
上传日期:2013-02-01
资源大小:101k
文件大小:5k
源码类别:
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 : HandleContainer
- %
- % VERSION : 1.00
- %
- % FILE : HandleContainer.h
- %
- % this Class allows to manage a container. When an application obtains a context
- % on a container it is this class which deals with thereafter all the entrance
- % points of the DLL for this specific container
- %----------------------------------------------------------------------------
- % Version 1.00
- %
- % CPX-31/03/2003-Creation
- %----------------------------------------------------------------------------
- % You can find wincrypt.h and cspdk 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 INCL_HANDLECONTAINER_H
- #define INCL_HANDLECONTAINER_H
- #include <windows.h>
- #include <wincrypt.h>
- #include "table.h"
- #include "cspdk.h"
- #include "pkcs.h"
- #include "pkcscontainer.h"
- #pragma once
- class HandleContainer
- {
- public:
- HandleContainer();
- ~HandleContainer();
- BOOL CreatePrivateExponentOneKey(LPTSTR szProvider,DWORD dwProvType,LPTSTR szContainer,DWORD dwKeySpec,HCRYPTPROV *hProv, HCRYPTKEY *hPrivateKey);
- BOOL ImportPlainSessionBlob(HCRYPTPROV hProv,HCRYPTKEY hPrivateKey,ALG_ID dwAlgId,LPBYTE pbKeyMaterial ,DWORD dwKeyMaterial ,HCRYPTKEY *hSessionKey);
- BOOL ExportPlainSessionBlob(HCRYPTKEY hPublicKey,HCRYPTKEY hSessionKey,LPBYTE *pbKeyMaterial ,DWORD *dwKeyMaterial );
- BOOL AcquireMicrosoftContext();
- BOOL CreateHandleContainer(const CHAR IN * const pszContainer,const DWORD IN dwFlags, PVTableProvStruc IN pVTable);
- BOOL CreateHash(ALG_ID Algid, HCRYPTKEY hCryptKey, DWORD dwFlags, HCRYPTHASH* phHash);
- BOOL DestroyHash(HCRYPTHASH hHash);
- BOOL GetHashParam(HCRYPTHASH hHash, DWORD dwParam, BYTE* pbData, DWORD*pdwDataLen, DWORD dwFlags);
- BOOL HashData(HCRYPTHASH hHash, CONST BYTE* pbData, DWORD dwDatalen, DWORD dwFlags);
- BOOL SetHashParam(HCRYPTHASH hHash, DWORD dwParam, BYTE*pbData, DWORD dwFlags);
- BOOL HandleContainer::GetProvParam(DWORD dwParam, BYTE* pbData, DWORD* pdwDataLen, DWORD dwFlags);
- BOOL Encrypt(HCRYPTKEY hKey, HCRYPTHASH hHash, BOOL Final, DWORD dwFlags, BYTE* pbData, DWORD*pdwDataLen, DWORD dwBufLen);
- BOOL Decrypt(HCRYPTKEY hKey, HCRYPTHASH hHash, BOOL Final, DWORD dwFlags, BYTE*pbData, DWORD*pdwDataLen);
- BOOL SignHash(HCRYPTHASH hHash, DWORD dwKeySpec, LPCWSTR sDescription, DWORD dwFlags, BYTE*pbSignature, DWORD* pdwSigLen);
- BOOL VerifySignature(HCRYPTHASH hHash, CONST BYTE* pbSignature, DWORD dwSigLen, HCRYPTKEY hPubKey, LPCTSTR sDescription, DWORD dwFlags);
- BOOL DestroyKey(HCRYPTKEY hKey);
- BOOL ImportKey(BYTE* pbData, DWORD dwDataLen, HCRYPTKEY hPubKey, DWORD dwFlags, HCRYPTKEY* phKey);
- BOOL GetKeyParam(HCRYPTKEY hKey, DWORD dwParam, BYTE* pbData, DWORD* pdwDataLen, DWORD dwFlags);
- BOOL SetKeyParam(HCRYPTKEY hKey, DWORD dwParam,CONST BYTE*pbData, DWORD dwFlags);
- BOOL GetUserKey(DWORD dwKeySpec, HCRYPTKEY* phUserKey);
- PKCSContainer* GetCurrentContainer(){return currentPContainer;}
- static bool VerifyHandleContainer(HandleContainer* handleContainer);
- static TableOfHandle handles_Container;
- private:
- PKCSContainer* currentPContainer;
- HCRYPTPROV microsoft_Provider;
- };
- #endif