Linker error with CryptoPP

"Sarath govind.k.k" <[email protected]>
Newsgroups gmane.comp.encryption.cryptopp
Message-ID <[email protected]>
Hi 

I have installed  the 5.6.5.4 version of cryptopp from nuget packages to 
generate an application . This application ran successfully in Visual 
studio 2015 , the project configuration was win32 console application. I 
have tried to run the same program in VS 2017 , I received lots of Linker 
errors 

LNK2001    unresolved external symbol "public: virtual void __thiscall 
CryptoPP::Rijndael::Base::UncheckedSetKey(unsigned char const *,unsigned 
int,class CryptoPP::NameValuePairs const &)" 
(?UncheckedSetKey@Base@Rijndael@CryptoPP@@UAEXPBEIABVNameValuePairs@3@@Z)
 
LNK2001    unresolved external symbol "public: virtual void __thiscall 
CryptoPP::Rijndael::Dec::ProcessAndXorBlock(unsigned char const *,unsigned 
char const *,unsigned char *)const " 
(?ProcessAndXorBlock@Dec@Rijndael@CryptoPP@@UBEXPBE0PAE@Z)

LNK2001    unresolved external symbol "public: virtual unsigned int 
__thiscall CryptoPP::Rijndael::Dec::AdvancedProcessBlocks(unsigned char 
const *,unsigned char const *,unsigned char *,unsigned int,unsigned 
int)const " (?AdvancedProcessBlocks@Dec@Rijndael@CryptoPP@@UBEIPBE0PAEII@Z)
 
sample program
----------------------
#include "stdafx.h"
#include "cryptopp\osrng.h"
#include "cryptopp\cryptlib.h"
#include "cryptopp\hex.h"
#include "cryptopp\filters.h"
#include "cryptopp\aes.h"
#include "cryptopp\des.h"
#include "cryptopp\modes.h"
#include "cryptopp\secblock.h"
#include <stdio.h>
#include <afx.h>
#include <iostream>
#include <string>
#include <iomanip>
#include <string.h>
#include <fstream>
#include <Windows.h>
#include <atlstr.h>
#include <winnt.h>
#include <atlcomcli.h>
#include <combaseapi.h>
#include "XDOM2.H"
#include "XDOM2.CPP"
using namespace std;
using CryptoPP::AutoSeededRandomPool;
using CryptoPP::Exception;
using CryptoPP::HexEncoder;
using CryptoPP::HexDecoder;
using CryptoPP::StringSink;
using CryptoPP::StringSource;
using CryptoPP::StreamTransformationFilter;
using CryptoPP::DES_EDE2;
using CryptoPP::CBC_Mode;
using CryptoPP::SecByteBlock;
//function for encryption
void encryptXMLFile(CString key, CString iv, CString fileLoc) {
string cipher;
string encoded;
CT2CA k(key);
string key1 = k;
CT2CA i(iv);
string iv1 = i;
//read the XML file to perform encryption
FILE *fStream;
CString plainText = L"";
errno_t errCode = _tfopen_s(&fStream, fileLoc, _T("r, ccs=UNICODE"));
if (0 == errCode)
{
string word;
CStdioFile File(fStream);
CString strLine;
while (File.ReadString(strLine))
{
plainText += strLine;
}
}
fflush(fStream);
fclose(fStream);
CT2CA pt__(plainText);
string content = pt__;
//XML parcer
XDOM xCommand;
HRESULT hr = S_FALSE;
hr = xCommand.setXML(plainText);
CString deviceList;
if (S_OK == hr) {
CComBSTR bstrContent;
hr = xCommand.getXML(L"HardwareCompareProfileContents", &bstrContent);
if (S_OK == hr)
{
XDOM xDeviceList;
hr = xDeviceList.setXML(bstrContent);
if (S_OK == hr)
{
CComBSTR bstrDeviceList;
xDeviceList.getXML(L"DeviceList", &bstrDeviceList);
deviceList = bstrDeviceList;
}
}
}
CT2CA pt(deviceList);
string pText = pt;
auto itr_ = content.find("<DeviceList>");
string header = content.substr(0, itr_);
auto itr_last = content.find("</DeviceList>");
int lastHeaderPos = itr_last + 13;
string headerClose = content.substr(lastHeaderPos);
string ciphertext;
CryptoPP::AES::Encryption aesEncryption((byte *)key1.c_str(), 
CryptoPP::AES::DEFAULT_KEYLENGTH);
CryptoPP::CBC_Mode_ExternalCipher::Encryption cbcEncryption(aesEncryption, 
(byte *)iv1.c_str());
CryptoPP::StreamTransformationFilter stfEncryptor(cbcEncryption, new 
CryptoPP::StringSink(ciphertext));
stfEncryptor.Put(reinterpret_cast<const unsigned char*>(pText.c_str()), 
pText.length() + 1);
stfEncryptor.MessageEnd();
encoded.clear();
StringSource(ciphertext, true, new HexEncoder(new StringSink(encoded)));
//save encoded file
CString encPath = L"Cryptography/encText.xml";
FILE *fEncypted;
errno_t errCode1 = _wfopen_s(&fEncypted, encPath, L"w, ccs=UNICODE");
if (errCode1 == 0)
{
CString headerText(header.c_str());
CStdioFile fileHeader(fEncypted);
fileHeader.WriteString(headerText);
CString encryptedText(encoded.c_str());
CStdioFile file(fEncypted);
file.WriteString("<EncryptedText>" + encryptedText + "</EncryptedText>");
CString headerCloseText(headerClose.c_str());
CStdioFile fileHeaderClose(fEncypted);
fileHeaderClose.WriteString(headerCloseText);
}
fflush(fEncypted);
fclose(fEncypted);
}
int main() {
::CoInitializeEx(0, COINITBASE_MULTITHREADED);
CString key = L"012";
CString iv = L"aaaaa";
CString fileLocation ;
encryptXMLFile(key, iv, fileLocation);
::CoUninitialize();
system("PAUSE");
return 0;
}

Would you please help me

-- 
You received this message because you are subscribed to the Google Groups "Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/cryptopp-users/5609155f-0d93-43c1-9f41-8fa3271ff77dn%40googlegroups.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.