Hi Jason,
2. Added the library path to Release directory that
came with the distribution
Are you building a Debug or Release build of your program?
I typically set up the VC++ environment as described below.
http://www.codeguru.com/Cpp/W-P/system/registry/article.php/c10743
Then, in sdtafx.h, I add the following:
In stdafx.h, add the following:
#ifdef _DEBUG
#pragma comment( lib, "cryptlibd" )
#else
#pragma comment( lib, "cryptlib" )
#endif
Jeff
[EMAIL PROTECTED] 1/25/2006 5:36 PM >>>
I have a basic encryption/decryption test program that fails to link.
I
am running VS6.0 with SP6 and I have also installed the Processor Pack.
I am using the 5.0.4 version. Here are the details:
In summary it is unable to link because it can't find
CryptoPP::g_nullNameValuePairs. It doesn't appear to be a specific
problem with my code that I am trying to compile, but rather inner
dependencies inside Cryptopp.
ERROR OUTPUT
CryptoTesting.cpp
Linking...
CryptoTesting.obj : error LNK2001: unresolved external
symbol "class CryptoPP::NullNameValuePairsconst
CryptoPP::g_nullNameValuePairs"
([EMAIL PROTECTED]@@[EMAIL PROTECTED]@B)
Debug/CryptoTesting.exe : fatal error LNK1120: 1 unresolved
externals
Error executing link.exe.
If I use the FIPS validated version 5.0.4, I configure VS6.0 to
1. Added the include directory
2. Added the library path to Release directory that
came with the distribution
3. Add the 'cryptopp.lib' to the list of libraries.
I have searched in multiple places with no luck finding the solution,
any assistance to resolving is gratefully accepted.
Thanks
Jason
Following is the code that is in my test program (this is actually
pulled from the FAQ):
//
// Key and IV setup
//
byte key[ CryptoPP::AES::DEFAULT_KEYLENGTH ], iv[
CryptoPP::AES::BLOCKSIZE ];
memset( key, 0x00, CryptoPP::AES::DEFAULT_KEYLENGTH );
memset( iv, 0x00, CryptoPP::AES::BLOCKSIZE );
//
// String and Sink setup
//
std::string plaintext = "Now is the time for all good men to come to
the aide...";
std::string ciphertext;
std::string decryptedtext;
//
// Dump Plain Text
//
std::cout << "Plain Text (" << plaintext.size() << " bytes)" <<
std::endl;
std::cout << plaintext;
std::cout << std::endl << std::endl;
//
// Create Cipher Text
//
CryptoPP::AES::Encryption aesEncryption(key,
CryptoPP::AES::DEFAULT_KEYLENGTH);
CryptoPP::CBC_Mode_ExternalCipher::Encryption cbcEncryption(
aesEncryption, iv );
CryptoPP::StreamTransformationFilter stfEncryptor(cbcEncryption, new
CryptoPP::StringSink( ciphertext ) );
stfEncryptor.Put( reinterpret_cast<const unsigned char*>(
plaintext.c_str() ), plaintext.length() + 1 );
stfEncryptor.MessageEnd();
//
// Dump Cipher Text
//
std::cout << "Cipher Text (" << ciphertext.size() << " bytes)" <<
std::endl;
for( int i = 0; i < ciphertext.size(); i++ ) {
std::cout << "0x" << std::hex << (0xFF &
static_cast<byte>(ciphertext[i])) << " ";
}
std::cout << std::endl << std::endl;
//
// Decrypt
//
CryptoPP::AES::Decryption aesDecryption(key,
CryptoPP::AES::DEFAULT_KEYLENGTH);
CryptoPP::CBC_Mode_ExternalCipher::Decryption cbcDecryption(
aesDecryption, iv );
CryptoPP::StreamTransformationFilter stfDecryptor(cbcDecryption, new
CryptoPP::StringSink( decryptedtext ) );
stfDecryptor.Put( reinterpret_cast<const unsigned char*>(
ciphertext.c_str() ), ciphertext.size() );
stfDecryptor.MessageEnd();
//
// Dump Decrypted Text
//
std::cout << "Decrypted Text: " << std::endl;
std::cout << decryptedtext;
std::cout << std::endl << std::endl;
return 0;