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-2004 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 #include "SymCipAlg.h" 00031 #include "SymCipAlgPara.h" 00032 #include "PKKeyGenerate.h" 00033 #include "DSAKeyGenrate.h" 00034 #include "DSASysPara.h" 00035 #include "ECSys.h" 00036 #include "mac.h" 00037 #include "PKMode.h" 00038 #include "ECGenerateKey.h" 00039 #include "MacKey.h" 00040 #include "hash.h" 00041 #include "PKParameters.h" 00042 #include "InvertibleRSAFunction2.h" 00043 00044 #include "pubkey.h" 00045 #include "dsa.h" 00046 00047 #include "PKCipPadHashAlg.h" 00048 #include "SymCipKeyGenerate.h" 00049 #include "Mode.h" 00050 #include "FileIO.h" 00051 #include "CryptoPPLink.h" 00052 #include "RSALoadKey.h" 00053 #include "userinfo.h" 00054 00055 #if !defined(AFX_ALGORITHMSHEET_H__C590A1B6_DC5E_4E4E_8B29_DD664930C824__INCLUDED_) 00056 #define AFX_ALGORITHMSHEET_H__C590A1B6_DC5E_4E4E_8B29_DD664930C824__INCLUDED_ 00057 00058 #if _MSC_VER > 1000 00059 #pragma once 00060 #endif // _MSC_VER > 1000 00061 // AlgorithmSheet.h : header file 00062 // 00064 // CAlgorithmSheet 00065 00066 class CAlgorithmSheet : public CPropertySheet 00067 { 00068 DECLARE_DYNAMIC(CAlgorithmSheet) 00069 00070 // Construction 00071 public: 00072 CAlgorithmSheet(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0); 00073 CAlgorithmSheet(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0); 00074 00075 // Attributes 00076 public: 00077 CSymCipAlg m_SymCipAlg_page; 00078 00079 // Define a derived RSA function that allows us to disable blinding 00080 InvertibleRSAFunction2 * m_RSAPrivateKeyNoBlind; 00081 //InvertibleRSAFunction2 m_RSAPrivateKey; 00082 00083 InvertibleRSAFunction m_RSAPrivateKey; 00084 RSAFunction m_RSAPublicKey; 00085 DL_GroupParameters_EC<ECP> m_ECPSysParameters; 00086 DL_GroupParameters_EC<EC2N> m_EC2NSysParameters; 00087 DL_GroupParameters_DSA m_DSASysParameters; 00088 ECDSA<ECP, SHA>::PrivateKey m_ECP_PrivateKey; 00089 ECDSA<ECP, SHA>::PublicKey m_ECP_PublicKey; 00090 ECDSA<EC2N, SHA>::PrivateKey m_EC2N_PrivateKey; 00091 ECDSA<EC2N, SHA>::PublicKey m_EC2N_PublicKey; 00092 00093 DSA::PrivateKey m_DSAPrivateKey; 00094 DSA::PublicKey m_DSAPublicKey; 00095 //CComp m_Comp_page; 00096 //CMACAlg m_MACAlg; 00097 //CMACHashAlg m_MACHashAlg; 00098 //CHashAlg m_HashAlg; 00099 CSymCipAlgPara m_SymCipAlgPara; 00100 00101 //Ashraf Public Key members 00102 //CPKCipAlgPara m_PKCipAlgPara; 00103 CPKKeyGenerate m_PKKeyGenerate; 00104 CDSAKeyGenrate m_PKDSAKeyGenerate; 00105 CDSASysPara m_DSASysPara; 00106 CECSys m_PKECSystemParameters; 00107 CECGenerateKey m_ECGenerateKey; 00108 CPKCipPadHashAlg m_PKCipPadHashAlg; 00109 CHash m_HASH_ALG; 00110 CMac m_MAC_ALG; 00111 CMACKey m_MAC_KEY; 00112 CPKParameters m_PKParameters; 00113 CRSALoadKey m_RSALoadKey; 00114 CUserInfo m_UserInfo; 00115 CSymCipKeyGenerate m_SymCipKeyGenerate; 00116 //CSymCipKeyLoad m_SymCipKeyLoad; 00117 CMode m_Mode; 00118 CPKMode m_CPKMode; 00119 CFileIO m_FileIO; 00120 00121 bool m_no_blinding; // Disable blinding during RSA 00122 00123 // Which library will we use 00124 int m_lib; 00125 00126 // User action parameters 00127 int m_operator; //sender/receiver 00128 int m_operation; //sym enc, dec etc. 00129 00130 /*================================================================*/ 00131 //parameter(s) for symmetric key encryption/decryption 00132 /*================================================================*/ 00133 int m_symCipAlg; //Symetric key cipher currently in use as integer 00134 CString m_symCipAlgString; //Symetric key cipher currently in use as string 00135 00136 int m_symCipBlockSizeArray[23]; //memory index for block size 00137 int m_symCipBlockSizeVal; //block size value for current algorithm 00138 00139 int m_symCipKeySizeArray[23][3]; //memory index for key size 00140 int m_symCipKeySizeVal; //key size value for current algorithm 00141 00142 int m_symCipRoundNumbArray[23][3]; //memory index for round number 00143 int m_symCipRoundNumbVal; //round number for current algorithm 00144 00145 int m_symCipKeyStrength; //key strengt [0,1,2] of current key 00146 00147 int m_symCipMode[23]; //memory for mode 00148 int m_symCipModeFeedBack[23][3]; //memory for for cfb/ofb feedback 00149 00150 00151 /*================================================================*/ 00152 //parameter(s) for public key encryption decryption 00153 /*================================================================*/ 00154 int m_pkCipAlg; // Public Key Cipher 00155 int m_pkCipPadAlg; // PK Enc/Dec Padding Algorithm 00156 int m_pkCipHashAlg; // PK Enc/Dec Hash Algorithm 00157 int m_pkCipPara[4][3]; // Array to hold key parameters 00158 00159 /*================================================================*/ 00160 //parameter(s) for public key signature and verification 00161 /*================================================================*/ 00162 int m_signVerAlg; // Signature Verification Algorithm 00163 int m_svPadAlg; // Signature/Verification Padding Algorithm 00164 int m_svHashAlg; // Signature/Verification Hash Algorithm 00165 int m_signVerPara[7][3]; // Array to hold key parameters 00166 00167 /*================================================================*/ 00168 //parameter(s) for hashing 00169 /*================================================================*/ 00170 int m_hashAlg; // Algorithm for hashing 00171 00172 /*================================================================*/ 00173 //parameters for mac authentication/generation 00174 /*================================================================*/ 00175 int m_macAlg; // MAC Algorithm 00176 int m_macHashAlg; // Hash algorithm for MAC 00177 00178 /*================================================================*/ 00179 //parameter(s) for compression 00180 /*================================================================*/ 00181 int m_compAlg; // Compression Algorithm 00182 int m_compLevel; // Compression Level 00183 00184 int m_pkCipNSize; // Size of modulus n for Public Key 00185 int m_pkCipEVal; // Value of e for Public Key 00186 int m_pkCipESize; // Size of e for Public Key 00187 00188 00189 /*================================================================*/ 00190 // Used by all 00191 /*================================================================*/ 00192 CByteArray m_cipKey; 00193 CByteArray m_cipIv; 00194 byte *m_PKIV; 00195 CString m_readFilePathName; 00196 CString m_writeFilePathName; 00197 00198 // Operations 00199 public: 00200 00201 // Overrides 00202 // ClassWizard generated virtual function overrides 00203 //{{AFX_VIRTUAL(CAlgorithmSheet) 00204 //}}AFX_VIRTUAL 00205 00206 // Implementation 00207 public: 00208 bool OCB; 00209 int m_pkDSAmod; 00210 CString HashName; 00211 int m_PKMode; 00212 int m_EC_Curve; 00213 int m_ECx; 00214 CString m_PKkeyFilename; 00215 CString m_PKUserName; 00216 virtual ~CAlgorithmSheet(); 00217 00218 // Generated message map functions 00219 protected: 00220 //{{AFX_MSG(CAlgorithmSheet) 00221 //}}AFX_MSG 00222 DECLARE_MESSAGE_MAP() 00223 }; 00224 00226 00227 //{{AFX_INSERT_LOCATION}} 00228 // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 00229 00230 #endif // !defined(AFX_ALGORITHMSHEET_H__C590A1B6_DC5E_4E4E_8B29_DD664930C824__INCLUDED_)