OpenSSLLink.h

Go to the documentation of this file.
00001 /***********************************************************************
00002 *
00003 * KRYPTOS - Educational software for teaching cryptography
00004 * For more information, see http://www.kryptosproject.org/
00005 * Submissions may be sent to kryptos@gmu.edu (see web site for details)
00006 * 
00007 * 
00008 * Copyright (c) 2002-2006 George Mason University
00009 * 
00010 * Permission is hereby granted, free of charge, to any person obtaining
00011 * a copy of this software and associated documentation files (the
00012 * "Software"), to deal in the Software without restriction, including
00013 * without limitation the rights to use, copy, modify, merge, publish,
00014 * distribute, sublicense, and/or sell copies of the Software, and to
00015 * permit persons to whom the Software is furnished to do so, subject
00016 * to the following conditions:
00017 *
00018 * The above copyright notice and this permission notice shall be
00019 * included in all copies or substantial portions of the Software.
00020 *
00021 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00022 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00023 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00024 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
00025 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
00026 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
00027 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00028 *
00029 ***********************************************************************/
00030 
00031 #pragma once
00032 #include "stdafx.h"
00033 
00034 #include <iostream>
00035 #include <math.h>
00036 #include <string>
00037 #include "Global.h"
00038 #include "KryptosTimer.h"
00039 
00040 #include "AlgorithmSheet.h"
00041 #include "CryptoLink.h"
00042 
00043 using namespace std;
00044 
00049 class COpenSSLLink : public CCryptoLink
00050 {
00051 public:
00052         COpenSSLLink();
00053         COpenSSLLink(CWnd* pParent,CAlgorithmSheet* options);
00054 
00055         virtual ~COpenSSLLink(void);
00056 
00057         DECLARE_DYNCREATE(COpenSSLLink);
00058 
00059         virtual void ProcessMACVer();
00060         virtual void ProcessMACGen();
00061         virtual void ProcessHash();
00062         virtual void ProcessHashVerify();
00063         virtual bool processVerify();
00064         virtual void processSign();
00065         virtual void processPK();
00066         virtual BOOL processRequest(DWORD numPumps,DWORD sizePumps,DWORD m_lastPump);
00067         virtual string ByteToHexString(byte *out, int bytesize);
00068         virtual byte *GetIV( int bytesize);
00069 
00070 private:
00071         bool ProcessDES();
00072         bool ProcessDESX();
00073         bool ProcessBF();
00074         bool ProcessDES_EDE2();
00075         bool ProcessDES_EDE3();
00076         bool Process3DES();
00077         bool ProcessIDEA();
00078         bool ProcessAES();
00079 
00080         void setParameterKey();
00081         void setParameterIV();
00082 
00083         unsigned int ReadBlock(ifstream *inFile, byte *inBlock, unsigned int blockSize);
00084 
00086         CAlgorithmSheet* p_AlgorithmSheet;
00088         CWnd* m_pParent;
00090         BYTE *m_iv;
00092         BYTE *m_key; 
00093         int m_operator,m_operation;
00094         BOOL m_success;
00096         DWORD m_numPumps,m_sizePumps,m_lastPump;
00098         int m_symCipAlg;
00100         int m_symCipKeySizeByte;
00102         int m_symCipBlockSizeByte;
00104         int m_rounds;
00106         int m_mode;
00108         int m_feedbackByte;
00109 
00111         CString pathInFile;
00113         CString pathOutFile;
00114 
00115         void HashFileToFile(const char *infilename, const char *outfilename,  string hash);
00116         string HashFileToString(const char *filename, string hash);
00117 };

Generated on Sun Dec 17 14:54:15 2006 for Kryptos by  doxygen 1.5.1-p1