Click here to Skip to main content
Click here to Skip to main content

Cryptest (MFC Style Crypto++ v4.2 Library GUI).

, 6 Jan 2002
Rate this:
Please Sign up or sign in to vote.
A GUI version of the Crypto++ v4.2 Library that was written by Wei Dai.

Introduction

This article makes use of the Crypto++ Library v4.2, see "Obtaining the Crypto++ v4.2 Library" below...

Overview

I developed this for two reasons,

  1. Because I promised in an earlier article, and
  2. I wanted to use the Crypto++ Library components in an application with a GUI.

Below is the GUI that is presented in this demo:

Obtaining the Crypto++ v4.2 Library

To run compile the demo code, you will need to download the Windows version of the Crypto++ Library v4.2 and source files from http://www.eskimo.com/~weidai/cryptlib.html, and compile it.

Implementation notes

Below you will find out what I did to get this built and working. If you follow the steps below, you will be able to compile/run this example.

  1. Download the Crypto++ v4.2 Library (see link above) & this demo.
  2. Compile the Crypto++ Library (both Debug/Release).
  3. Take the Debug version of the library and rename it to cryptlib42d.lib.
  4. Take the Release version of the library and rename it to cryptlib42r.lib.
  5. Copy the *.lib files to both of the LIB directories where VC++ is installed.
  6. Unzip the demo and put it into a directory of your choice.
  7. Go to the Menu -> Tools | Options | Directory Tab, and enter the directory path where you unziped the Crypto++ Library to.
  8. Go to the Menu -> Project | Settings | Link Tab, and enter the build library (cryptlib42d.lib/cryptlib42r.lib) in the "Object/Library modules" edit box.
  9. Make sure the above library matches the build (*r.lib=Release/*d.lib=Debug) for the Cryptest demo.
  10. Compile the Cryptest demo (do not run it from here).
  11. For the validation portion to work, you need to copy the .dat files from the Crypto++ location to the build directory (Debug/Release).
  12. Go To the Cryptest.exe and execute it from Windows Explorer.
  13. Let me know how it goes!!!!

Now that you have the demo working, let me explain a few things...

I have made the GUI so that it is a bit hard to get it to error (although it is possible!).

I used the following functions in this demo:

  • GenerateRSAKey
  • RSADecryptString
  • RSAEncryptString
  • RSASignFile
  • RSAVerifyFile
  • EncryptString(using DES-EDE in CBC Mode)
  • DecryptString(using DES-EDE in CBC Mode)
  • EncryptFile
  • DecryptFile
  • SecretShareFile
  • SecretRecoverFile
  • InformationDisperseFile
  • InformationRecoverFile
  • GzipFile
  • GunzipFile
  • DigestFile

Acknowledgements

I notified Wei Dai that I was doing this project and asked his permission to post this at CodeProject. He was kind enough to answer the email and he let me know that this posting was covered in the License.txt file. So, you do not need to bother him with these dumb questions as I did.

A special thanks to Wei Dai for making the Crypto++ Library publically available for us to enjoy it!!!

Known bugs/issues

  • Only tested with Visual C++ 6.0 SP5.
  • Only tested with Windows 2000.
  • NOT tested with WindowsXP (yet).
  • It is not fully tested and debugged.

Bugs

  • None yet...

Issues

  • For you to see TCP forwarding working, you must receive TCP packets on the port specified, otherwise the machine will seem to hang whilst it listens on the port.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Dan Madden
Product Manager
Germany Germany
I have been programming (as a hobby) for 20+ years (Unix C, Scripting, VB, C/C++, C#). I am getting too old to talk about it and been in the Security line of work (both Military/Civilian) for 25+ years.

Comments and Discussions

 
QuestionI encountered numorous errors during compiling (Crypto++ 5.2.2 is used), what is wrong? PinmemberSstar912-Jan-09 17:29 
I have closely followed your implementation instructions. And I have no problem to complie the library of Crypto++ 5.2.2. Here are the 22 errors and 1 warning I got, anybody has any idea about this?
 
--------------------Configuration: Cryptest - Win32 Debug--------------------
Compiling resources...
Compiling...
StdAfx.cpp
Compiling...
bench.cpp
You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning.
You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning.
D:\CryptestDemo\Cryptest\bench.cpp(12) : fatal error C1083: Cannot open include file: 'md5mac.h': No such file or directory
BenchMark.cpp
Cryptest.cpp
You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning.
D:\CryptestDemo\Cryptest\Cryptest.cpp(243) : error C2039: 'MaxPlainTextLength' : is not a member of 'PK_FinalTemplate<class CryptoPP::TF_EncryptorImpl<struct CryptoPP::TF_CryptoSchemeOptions<class CryptoPP::TF_ES<class CryptoPP::OAEP<class CryptoPP:
:SHA1,class CryptoPP::P1363_MGF1>,struct CryptoPP::RSA,int>,struct CryptoPP::RSA,class CryptoPP::OAEP<class CryptoPP::SHA1,class CryptoPP::P1363_MGF1> > > >'
D:\CryptestDemo\Cryptest\Cryptest.cpp(249) : error C2039: 'CipherTextLength' : is not a member of 'PK_FinalTemplate<class CryptoPP::TF_EncryptorImpl<struct CryptoPP::TF_CryptoSchemeOptions<class CryptoPP::TF_ES<class CryptoPP::OAEP<class CryptoPP::S
HA1,class CryptoPP::P1363_MGF1>,struct CryptoPP::RSA,int>,struct CryptoPP::RSA,class CryptoPP::OAEP<class CryptoPP::SHA1,class CryptoPP::P1363_MGF1> > > >'
D:\CryptestDemo\Cryptest\Cryptest.cpp(253) : error C2039: 'CipherTextLength' : is not a member of 'PK_FinalTemplate<class CryptoPP::TF_EncryptorImpl<struct CryptoPP::TF_CryptoSchemeOptions<class CryptoPP::TF_ES<class CryptoPP::OAEP<class CryptoPP::S
HA1,class CryptoPP::P1363_MGF1>,struct CryptoPP::RSA,int>,struct CryptoPP::RSA,class CryptoPP::OAEP<class CryptoPP::SHA1,class CryptoPP::P1363_MGF1> > > >'
D:\CryptestDemo\Cryptest\Cryptest.cpp(255) : error C2039: 'CipherTextLength' : is not a member of 'PK_FinalTemplate<class CryptoPP::TF_EncryptorImpl<struct CryptoPP::TF_CryptoSchemeOptions<class CryptoPP::TF_ES<class CryptoPP::OAEP<class CryptoPP::S
HA1,class CryptoPP::P1363_MGF1>,struct CryptoPP::RSA,int>,struct CryptoPP::RSA,class CryptoPP::OAEP<class CryptoPP::SHA1,class CryptoPP::P1363_MGF1> > > >'
D:\CryptestDemo\Cryptest\Cryptest.cpp(257) : error C2039: 'CipherTextLength' : is not a member of 'PK_FinalTemplate<class CryptoPP::TF_EncryptorImpl<struct CryptoPP::TF_CryptoSchemeOptions<class CryptoPP::TF_ES<class CryptoPP::OAEP<class CryptoPP::S
HA1,class CryptoPP::P1363_MGF1>,struct CryptoPP::RSA,int>,struct CryptoPP::RSA,class CryptoPP::OAEP<class CryptoPP::SHA1,class CryptoPP::P1363_MGF1> > > >'
D:\CryptestDemo\Cryptest\Cryptest.cpp(271) : error C2039: 'CipherTextLength' : is not a member of 'PK_FinalTemplate<class CryptoPP::TF_DecryptorImpl<struct CryptoPP::TF_CryptoSchemeOptions<class CryptoPP::TF_ES<class CryptoPP::OAEP<class CryptoPP::S
HA1,class CryptoPP::P1363_MGF1>,struct CryptoPP::RSA,int>,struct CryptoPP::RSA,class CryptoPP::OAEP<class CryptoPP::SHA1,class CryptoPP::P1363_MGF1> > > >'
D:\CryptestDemo\Cryptest\Cryptest.cpp(272) : error C2039: 'CipherTextLength' : is not a member of 'PK_FinalTemplate<class CryptoPP::TF_DecryptorImpl<struct CryptoPP::TF_CryptoSchemeOptions<class CryptoPP::TF_ES<class CryptoPP::OAEP<class CryptoPP::S
HA1,class CryptoPP::P1363_MGF1>,struct CryptoPP::RSA,int>,struct CryptoPP::RSA,class CryptoPP::OAEP<class CryptoPP::SHA1,class CryptoPP::P1363_MGF1> > > >'
D:\CryptestDemo\Cryptest\Cryptest.cpp(274) : error C2039: 'MaxPlainTextLength' : is not a member of 'PK_FinalTemplate<class CryptoPP::TF_DecryptorImpl<struct CryptoPP::TF_CryptoSchemeOptions<class CryptoPP::TF_ES<class CryptoPP::OAEP<class CryptoPP:
:SHA1,class CryptoPP::P1363_MGF1>,struct CryptoPP::RSA,int>,struct CryptoPP::RSA,class CryptoPP::OAEP<class CryptoPP::SHA1,class CryptoPP::P1363_MGF1> > > >'
D:\CryptestDemo\Cryptest\Cryptest.cpp(275) : error C2660: 'Decrypt' : function does not take 2 parameters
D:\CryptestDemo\Cryptest\Cryptest.cpp(286) : error C2146: syntax error : missing ';' before identifier 'rng'
D:\CryptestDemo\Cryptest\Cryptest.cpp(286) : warning C4551: function call missing argument list
D:\CryptestDemo\Cryptest\Cryptest.cpp(286) : error C2065: 'rng' : undeclared identifier
D:\CryptestDemo\Cryptest\Cryptest.cpp(299) : error C2664: 'unsigned int __thiscall CryptoPP::BufferedTransformation::Get(unsigned char *,unsigned int)' : cannot convert parameter 2 from 'unsigned int (void) const' to 'unsigned int'
Conversion is a valid standard conversion, which can be performed implicitly or by use of static_cast, C-style cast or function-style cast
D:\CryptestDemo\Cryptest\Cryptest.cpp(302) : error C2039: 'PutSignature' : is not a member of 'SignatureVerificationFilter'
d:\cryptopp552\filters.h(360) : see declaration of 'SignatureVerificationFilter'
D:\CryptestDemo\Cryptest\Cryptest.cpp(362) : error C2039: 'ptr' : is not a member of 'SecBlock<unsigned char,class CryptoPP::AllocatorWithCleanup<unsigned char,0> >'
D:\CryptestDemo\Cryptest\Cryptest.cpp(412) : error C2039: 'ptr' : is not a member of 'SecBlock<unsigned char,class CryptoPP::AllocatorWithCleanup<unsigned char,0> >'
D:\CryptestDemo\Cryptest\Cryptest.cpp(620) : error C2039: 'EofReceived' : is not a member of 'SocketSource'
d:\cryptopp552\socketft.h(191) : see declaration of 'SocketSource'
D:\CryptestDemo\Cryptest\Cryptest.cpp(620) : error C2039: 'EofReceived' : is not a member of 'SocketSource'
d:\cryptopp552\socketft.h(191) : see declaration of 'SocketSource'
D:\CryptestDemo\Cryptest\Cryptest.cpp(620) : fatal error C1903: unable to recover from previous error(s); stopping compilation
CryptestDlg.cpp
FileStffDlg.cpp
TCPForwarding.cpp
Validat1.cpp
D:\CryptestDemo\Cryptest\Validat1.cpp(10) : fatal error C1083: Cannot open include file: 'cbc.h': No such file or directory
Validat2.cpp
You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning.
D:\CryptestDemo\Cryptest\Validat2.cpp(20) : fatal error C1083: Cannot open include file: 'blumgold.h': No such file or directory
Validat3.cpp
You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning.
You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning.
D:\CryptestDemo\Cryptest\Validat3.cpp(17) : fatal error C1083: Cannot open include file: 'haval.h': No such file or directory
Validation.cpp
Generating Code...
Error executing cl.exe.
 
Cryptest.exe - 22 error(s), 1 warning(s)
 
Create Bugs and Kill Bugs

AnswerRe: I encountered numorous errors during compiling (Crypto++ 5.2.2 is used), what is wrong? PinmemberJeffrey Walton18-Feb-09 10:48 
GeneralCrypto++ Integration Article PinmemberJeffrey Walton8-Dec-06 18:17 
Generalreproducing your sample PinmemberSamuel gerber9-May-05 4:05 
GeneralLots of errors when I compile the Crypto++ PinmemberROCKISDEAD15-Mar-05 10:17 
GeneralRe: Lots of errors when I compile the Crypto++ Pinmemberli.cao6-Apr-05 21:43 
GeneralMax message length PinmemberPetitjean28-Jan-05 3:09 
QuestionHow to convert HEX to bytes... PinmemberRitcho8-Oct-04 16:45 
Generalv5.1- ElGamal &amp; DSA 2048-bit key generation error Pinmemberniuyanhua11-Jul-04 14:59 
Generalv5.1 Library GUI Pinmemberniuyanhua5-Jul-04 16:47 
GeneralMFC DLL Crypto++ v5.1 Pinsussckmluu11-May-04 2:13 
GeneralRe: MFC DLL Crypto++ v5.1 PinmemberDan Madden11-May-04 2:24 
GeneralRe: MFC DLL Crypto++ v5.1 Pinsussckmluu11-May-04 6:02 
GeneralRe: MFC DLL Crypto++ v5.1 PinmemberDan Madden11-May-04 6:14 
GeneralRe: MFC DLL Crypto++ v5.1 PinmemberDan Madden11-May-04 6:27 
GeneralRe: MFC DLL Crypto++ v5.1 Pinsussckmluu11-May-04 20:52 
GeneralRe: MFC DLL Crypto++ v5.1 PinmemberDan Madden12-May-04 1:55 
GeneralRe: MFC DLL Crypto++ v5.1 Pinmemberckmluu12-May-04 5:24 
QuestionHelp me. How to Gzip string? Pinmemberkempge1-May-04 17:27 
QuestionHow to Gzip a string? PinmemberWatcher_bj30-Apr-04 22:28 
GeneralGreat PinmemberAnthony_Yio14-Apr-04 18:13 
QuestionHow to override the OnOpenDocument() function PinmemberVC ++ master20-Jan-04 6:19 
AnswerRe: How to override the OnOpenDocument() function PinmemberDaniel Madden10-Mar-04 18:52 
QuestionHelp me Please?? Pinmemberxxhimanshu11-Nov-03 20:26 
GeneralMulti thread App (Run time error) Help me. please... Pinmembermuhon10-Jun-03 5:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web03 | 2.8.140718.1 | Last Updated 7 Jan 2002
Article Copyright 2002 by Dan Madden
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid