?? handlecontainer.h
字號:
/****************************************************************************
* 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
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -