Crypt Library Demo 1.00

CryptographyExt.h

Go to the documentation of this file.
00001 /* This file is part of Crypt Library Demo application developed by Mihai MOGA.
00002 
00003 Image Converter is free software: you can redistribute it and/or modify it
00004 under the terms of the GNU General Public License as published by the Open
00005 Source Initiative, either version 3 of the License, or any later version.
00006 
00007 Image Converter is distributed in the hope that it will be useful, but
00008 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00009 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
00010 
00011 You should have received a copy of the GNU General Public License along with
00012 Crypt Library Demo.  If not, see <http://www.opensource.org/licenses/gpl-3.0.html>*/
00013 
00014 // CryptographyExt.h : Demo for Microsoft's Crypt Library functions.
00015 // Author: Stefan-Mihai MOGA, e-mail: contact@mihaimoga.com, phone: +40745497982
00016 
00017 #pragma once
00018 
00019 #define CRYPT_LIBRARY_NAME _T("Crypt")
00020 #define MD5CHECKSUM_LENGTH 0x10
00021 #define SHA1CHECKSUM_LENGTH 0x14
00022 #define MAX_STR_BUFFER 0x1000
00023 #define MAX_CRYPT_TAIL 0x1000
00024 
00025 // for CLongBinary
00026 #include <afxdb_.h>
00027 #include <WinCrypt.h>
00028 
00029 void TraceLastError(LPCTSTR lpszLibrary, LPCTSTR lpszOperation, DWORD dwLastError);
00030 
00031 CString GetComputerID();
00032 
00033 BOOL ConvertHexaToBinary(LPBYTE lpszOutputBuffer, DWORD dwOutputLength, LPCTSTR lpszInputBuffer, DWORD dwInputLength);
00034 BOOL ConvertHexaToBinary(CLongBinary* pTargetBinary, CLongBinary* pSourceBinary);
00035 
00036 BOOL ConvertBinaryToHexa(LPTSTR lpszOutputBuffer, DWORD dwOutputLength, LPBYTE lpszInputBuffer, DWORD dwInputLength);
00037 BOOL ConvertBinaryToHexa(CLongBinary* pTargetBinary, CLongBinary* pSourceBinary);
00038 
00039 // recommended values for nAlgorithm are CALG_MD5 and CALG_SHA1
00040 BOOL GetChecksumBuffer(ALG_ID nAlgorithm, LPBYTE lpszOutputBuffer, DWORD& dwOutputLength, LPBYTE lpszInputBuffer, DWORD dwInputLength);
00041 BOOL GetChecksumString(ALG_ID nAlgorithm, CString& strResult, CString strBuffer);
00042 BOOL GetChecksumFile(ALG_ID nAlgorithm, CString& strResult, CString strPathName);
00043 
00044 // recommended values for nAlgorithm are CALG_RC4 and CALG_3DES
00045 BOOL EncryptBuffer(ALG_ID nAlgorithm, LPBYTE lpszOutputBuffer, DWORD& dwOutputLength, LPBYTE lpszInputBuffer, DWORD dwInputLength, LPBYTE lpszSecretKey, DWORD dwSecretKey);
00046 BOOL EncryptFile(ALG_ID nAlgorithm, CString strOutputName, CString strInputName, LPBYTE lpszSecretKey, DWORD dwSecretKey);
00047 BOOL DecryptBuffer(ALG_ID nAlgorithm, LPBYTE lpszOutputBuffer, DWORD& dwOutputLength, LPBYTE lpszInputBuffer, DWORD dwInputLength, LPBYTE lpszSecretKey, DWORD dwSecretKey);
00048 BOOL DecryptFile(ALG_ID nAlgorithm, CString strOutputName, CString strInputName, LPBYTE lpszSecretKey, DWORD dwSecretKey);
 All Classes Files Functions Variables Enumerator Defines