|
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
|
|
|
|
|
|
|
Hello great work!
Your project was eased to compile(thanks)! But to be sure to understand I tried to create a new project reproducing your sample and using only the part of the "FileStuff" but without success. Can You help me!
...
std::allocator<char> >::~basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >(void)" (??1?$basic_strin
g@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in cryptlib42d.lib(filters.obj)
...
thanks
Samuel
|
|
|
|
|
Hello I followed the procedure explained but I can't compile the Debug/Release of Crypto++ because I receive lot's of coded errors, some help??
(Using .Net 2003)
|
|
|
|
|
I use Visual c++, it seems ok. first of all, you need compile pch.cpp, which is in the source files of cryptlib files.
|
|
|
|
|
Hello, I'm tring to use crypto++ 5.2.1 and I notice that the maximum message length that I can encrypt is KeyLength/8-42 (ex for a 1024bits key : 1024/8-42 = 86 characters max)
So I can't use 128 or 256 bits key
Someone know where does the -42 comes from ?
thanks for all
|
|
|
|
|
Hi all,
Just wondering how I might be able to convert the HEX encrypted text output to normal, 8-bit characters?
Thanks.
|
|
|
|
|
256, 512, 1024 bit keys all could be generated correctly. But when the program generate 2048-bit key, errors will occur.
I want confirmation that the lib is ok to generate 2048-bit keys.
Thanks a lot!
|
|
|
|
|
Hello, sir. After testing, I found that the MFC Style Crypto++ v4.2 Library GUI could not be used with v5.1. Since I want to demo Crypto++ v5.1, I have been trying to make a GUI for v5.1 in a similar way. First I only test RSA. But there always is such an error:
\crypto51\secblock.h(191) : fatal error C1076: compiler limit : internal heap limit reached; use /Zm to specify a higher limit
Error executing cl.exe.
After using /Zm to specify a higher limit, there will be lots of linking errors.
Could you please help me with the GUI demo for Crypto++ v5.1? Thank you very much. The above problem has already harrassed me for several days.
Yanhua
Yanhua
|
|
|
|
|
I have written a dll library from Crypto++ v5.1. and GUI in VC6 to test it.
Everything works correctly except encrypting and decrypting
string. When I start GUI the library encrypts and decrypts
string only for a first time. When I try to call this function
second time application generates error and displaying window:
"Debug Assertion Failed"
file: dbgheap.c
line:1044
----------------------------------------------
/*
* If this ASSERT fails, a bad pointer has been passed in. It may be
* totally bogus, or it may have been allocated from another heap.
* The pointer MUST come from the 'local' heap.
*/
_ASSERTE(_CrtIsValidHeapPointer(pUserData));
-----------------------------------------------
My dll is a MFC dll.
Please let me know if you've seen something like this.
|
|
|
|
|
Do you have some example code to show us where the problem is?
Regards,
Dan
|
|
|
|
|
Here is the encrypt method defined in dll file:
------------------------------------------------------
CString CMFCCryptDLLApp::RSAEncryptString(const char *pubFilename, const char *message)
{
FileSource pubFile(pubFilename, true, new HexDecoder);
RSAES_OAEP_SHA_Encryptor pub(pubFile);
AutoSeededRandomPool rng;
char outStr[1024];
std::string result;
StringSource(message, true, new PK_EncryptorFilter(rng, pub, new HexEncoder(new StringSink(result))));
sprintf(outStr,"%s", result.c_str());
CString Cresult(outStr);
return Cresult;
}
--------------------------------------------------------
When I calling this method from dll in dialog file:
--------------------------------------------------------
void CGUICrypto51Dlg::OnExecute()
{
CMFCCryptDLLApp* cipher = (CMFCCryptDLLApp*) AfxGetApp();
.
.
.
case 4:
m_sEncrypted = cipher->RSAEncryptStringSeed(m_sPubFileName, m_sMessage);
GetDlgItem(IDC_ENCRYPTED)->SetWindowText(m_sEncrypted);
GetDlgItem(RAD_DECRYPT)->EnableWindow(TRUE);
break;
.
.
.
}
--------------------------------------------------------
I need dll because I have to create GUI in VB. For now a test it in VC6.0.
I don't know where is the problem - in dll? or GUI?
As I said it works correctly if I click button (Encrypt String) first time.
Next test returns that error. Maybe it needs to free memory ...
If you need more soure code - let me know.
Thans for last fast replay.
Regards,
Lukasz Kuznicki
|
|
|
|
|
Your function is called "RSAEncryptString(...)", but you are calling "cipher->RSAEncryptStringSeed"?? Is there more code somewhere or is this a type-o ??
Regards,
Dan
|
|
|
|
|
Here is how I do it in one of my newer apps:
CString RSAEncryptString(const char *pubFilename, const char *seed, const char *message)
{
CString csErr;
try
{
FileSource pubFile(pubFilename, true, new HexDecoder);
RSAES_OAEP_SHA_Encryptor pub(pubFile);
RandomPool randPool;
randPool.Put((byte *)seed, strlen(seed));
string result;
StringSource(message, true, new PK_EncryptorFilter(randPool, pub, new HexEncoder(new StringSink(result))));
CString csRet;
csRet.Format("%s", result.c_str());
return csRet;
}
catch(CryptoPP::Exception &e)
{
csErr.Format("CryptoPP: %s",e.what());
WriteLogFile(csErr, "RSAEncryptString()", 1);
}
catch(std::exception &e)
{
csErr.Format("std: %s",e.what());
WriteLogFile(csErr, "RSAEncryptString()", 1);
}
return csErr;
}
CString RSADecryptString(const char *privFilename, const char *ciphertext)
{
CString csErr;
try
{
FileSource privFile(privFilename, true, new HexDecoder);
RSAES_OAEP_SHA_Decryptor priv(privFile);
string result;
StringSource(ciphertext, true, new HexDecoder(new PK_DecryptorFilter(GlobalRNG(), priv, new StringSink(result))));
CString csRet;
csRet.Format("%s", result.c_str());
return csRet;
}
catch(CryptoPP::Exception &e)
{
csErr.Format("CryptoPP: %s",e.what());
WriteLogFile(csErr, "RSADecryptString()", 1);
}
catch(std::exception &e)
{
csErr.Format("std: %s",e.what());
WriteLogFile(csErr, "RSADecryptString()", 1);
}
return csErr;
}
Regards,
Dan
|
|
|
|
|
Sorry Dan, it should be "cipher->RSAEncryptString()" - my mistake.
I defined in dll two kinds of RSAEncryptString functions:
1. CString RSAEncryptStringSeed(const char *pubFilename, const char *seed, const char *message);
2. CString RSAEncryptString(const char *pubFilename, const char *message);
In second function I use autoseed, so there isn't variable seed.
As I described in advance both of them work correctly, but application
which uses the dll returns "Debug Assertion Failed" after second calling one of them. I applayed Your method, but the same error apperars. I notice that there is a problem only with functions which returns CString.
Thankyou for your interest and patience.
Regards,
Lukasz
|
|
|
|
|
Have you tried making the functions return "const char *" instead of a CString ??
Regards,
Dan
|
|
|
|
|
I have just tried to use your suggestion. I think it works much better now - GIU doesn't return errors.
But there is another problem. My function looks like below:
const char* RSAEncryptStringSeed(const char *pubFilename, const char *seed, const char *message)
{
...
string result;
StringSource(message, true, new PK_EncryptorFilter(randPool, pub, new HexEncoder(new StringSink(result))));
const char* csRet;
csRet = result.c_str();
return csRet;
}
DLL always returns: {"ÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝ"
Now I trying to use different string formating ...
Thanks a lot Dan.
Lukasz
|
|
|
|
|
Hi all,
It's really a great work. thanks you all.
Currentlt, i want to make use of the Cryptlib4.2 for my project.
But it's doesn't work once i want the lib GZIP a string. below is the details.
code1 :
string sInput = "Just for test";
string sOutput
StringSource(sInput, true, new Gzip(new StringSink(sOutput), deflate_level));
code2:
std::string outstr;
Gzip ziper( new StringSink(outstr), deflate_level );
ziper.Put((byte *)in, strlen(in));
ziper.MessageEnd();
After executed, both they all ouput "?", i don't know why.
It's highly appreciated for your great help.
Kemp Ge
Hi, everyone.
|
|
|
|
|
int GzipString(const char *in, char *out, int deflate_level)
{
int nResult = RETURN_EXIST;
std::string outstr;
Gzip ziper( new StringSink(outstr), deflate_level );
ziper.Put((byte *)in, strlen(in));
ziper.MessageEnd();
sprintf(out,"%s", outstr.c_str());
}
why can it not work successfully?
How to do?
|
|
|
|
|
I was wondering should anyone be writing the demo of this long time ago. The demo provided by Wei Dai is troublesome to be used and could not demonstrate all of the algorithms provided by him effectively. And finally, here you are. Thanks man.
[modified]oops, it seems that it has been here for some time[/modified]
Sonork 100.41263:Anthony_Yio
Life is about experiencing ...
|
|
|
|
|
I am building an editor sort of thing in vc++ and i want to get the filename of the open file & for that i want to know How to override the OnOpenDocument() function and also how to edit the text in the title bar of the SDI application's window.
|
|
|
|
|
<br />
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)<br />
{<br />
if( !CFrameWnd::PreCreateWindow(cs) )<br />
return FALSE;<br />
<br />
cs.style = WS_OVERLAPPED | WS_CAPTION | FWS_ADDTOTITLE<br />
| WS_THICKFRAME | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_MAXIMIZE;<br />
<br />
cs.style &= ~(LONG) FWS_ADDTOTITLE;<br />
cs.lpszName = "APP - Add some Text";<br />
<br />
return TRUE;<br />
}<br />
<br />
<br />
Regards,
Dan
|
|
|
|
|
Hi,
I have read many places and found that Crypto++ functions are very much compatible to php mcrypt library. I never knew how to use this in VC++ application. You have dobe such a wonderful work and its so easy to understand that i can compile and run your code easily. But i am having a small problem and hope that you can solve it out. I have to use the mcrypt library of php to encrypt a file at server and i have to decrypt the same file on client side using VC++. I am using Rijndael algorithm for encryption at server side through PHP. as the documentation says...
mcrypt's MCRYPT_RIJNDAEL_128 is compatible with cryptopp-php's CRYPTOPP_CIPHER_AES/ CRYPTOPP_CIPHER_RIJNDAEL, which are just aliases for each other.
and
MCRYPT_MODE_CBC in mcrypt and CRYPTOPP_MODE_CBC in cryptopp-php.
MCRYPT_MODE_ECB in mcrypt and CRYPTOPP_MODE_ECB in cryptopp-php.
Can you tell me how to use crypto++ to do the same. or show me some piece of code to make it easy to understand..I need it urgently..Please help in doing the same. Any help or pointers are highly appreciated.
Thanks a lot in advance..
Regards,
Himanshu
|
|
|
|
|
Program :
Ftp server & Crypto++ makes...
Usage.
-- Files encrypt / decrypt use.
Error :
When user connecting, program runtime error
-- Unhandled exception in FTPServer.exe:pxC0000005: Access Violation.
Error Code section: (I think ...)
ASSERT(CAsyncSocket::LookupHandle(hSocket, bDead) == NULL);
if (pState->m_pmapSocketHandle->IsEmpty())
-------------------------------------------
Others program (I think ...)
When I tested other programs with folowing codes, I found same errors.
- Mutithread program
- CTypedPtrList<CObList, ConnectThread*> m_ThreadList; <-- I think
- Socket
Have a nice day! bye.
yang hyuk
|
|
|
|
|