Вопрос

I am pretty new to C++ and I need to use Crypto++. I have been looking for examples that explain how to use it. I found this Example of AES using Crypto++ . And I think this is great... the only thing is when I try to build it, I get a bunch of errors!

First off, I had to change the include path for the header files. I am not sure why, but when I didn't add the "crypto++" in front of the path, it could not find the header files. Another post suggested to use it and it seems to make the errors go away.

In case you want to see the code I am trying to build, it is here:

#include <iostream>
#include <string>
#include <iomanip>

#include "crypto++/modes.h"
#include "crypto++/aes.h"
#include "crypto++/filters.h"
using namespace std;
int main(int argc, char* argv[]) {

    //
    // Key and IV setup
    //AES encryption uses a secret key of a variable length (128-bit, 196-bit or 256-   
    //bit). This key is secretly exchanged between two parties before communication   
    //begins. DEFAULT_KEYLENGTH= 16 bytes
    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
    //
    string plaintext = "Now is the time for all good men to come to the aide...";
    string ciphertext;
    string decryptedtext;

    //
    // Dump Plain Text
    //
    cout << "Plain Text (" << plaintext.size() << " bytes)" << endl;
    cout << plaintext;
    cout << endl << 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
    //
    cout << "Cipher Text (" << ciphertext.size() << " bytes)" << endl;

    for( int i = 0; i < ciphertext.size(); i++ ) {

        cout << "0x" << hex << (0xFF & static_cast<byte>(ciphertext[i])) << " ";
    }

    cout << endl << 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
    //
    cout << "Decrypted Text: " << endl;
    cout << decryptedtext;
    cout << endl << endl;

    return 0;
}

These are the errors I get

/tmp/cczoSf1S.o: In function `CryptoPP::SimpleKeyingInterface::~SimpleKeyingInterface()':
AES.cpp:(.text._ZN8CryptoPP21SimpleKeyingInterfaceD2Ev[_ZN8CryptoPP21SimpleKeyingInterfaceD5Ev]+0xb): undefined reference to `vtable for CryptoPP::SimpleKeyingInterface'
/tmp/cczoSf1S.o: In function `CryptoPP::SimpleKeyingInterface::SimpleKeyingInterface()':
AES.cpp:(.text._ZN8CryptoPP21SimpleKeyingInterfaceC2Ev[_ZN8CryptoPP21SimpleKeyingInterfaceC5Ev]+0x8): undefined reference to `vtable for CryptoPP::SimpleKeyingInterface'
/tmp/cczoSf1S.o: In function `CryptoPP::BlockTransformation::~BlockTransformation()':
AES.cpp:(.text._ZN8CryptoPP19BlockTransformationD2Ev[_ZN8CryptoPP19BlockTransformationD5Ev]+0xb): undefined reference to `vtable for CryptoPP::BlockTransformation'
/tmp/cczoSf1S.o: In function `CryptoPP::Rijndael::Base::~Base()':
AES.cpp:(.text._ZN8CryptoPP8Rijndael4BaseD2Ev[_ZN8CryptoPP8Rijndael4BaseD5Ev]+0xc): undefined reference to `vtable for CryptoPP::Rijndael::Base'
AES.cpp:(.text._ZN8CryptoPP8Rijndael4BaseD2Ev[_ZN8CryptoPP8Rijndael4BaseD5Ev]+0x16): undefined reference to `vtable for CryptoPP::Rijndael::Base'
/tmp/cczoSf1S.o: In function `CryptoPP::Rijndael::Enc::~Enc()':
AES.cpp:(.text._ZN8CryptoPP8Rijndael3EncD2Ev[_ZN8CryptoPP8Rijndael3EncD5Ev]+0xb): undefined reference to `vtable for CryptoPP::Rijndael::Enc'
AES.cpp:(.text._ZN8CryptoPP8Rijndael3EncD2Ev[_ZN8CryptoPP8Rijndael3EncD5Ev]+0x15): undefined reference to `vtable for CryptoPP::Rijndael::Enc'
/tmp/cczoSf1S.o: In function `CryptoPP::BlockTransformation::BlockTransformation()':
AES.cpp:(.text._ZN8CryptoPP19BlockTransformationC2Ev[_ZN8CryptoPP19BlockTransformationC5Ev]+0x15): undefined reference to `CryptoPP::Algorithm::Algorithm(bool)'
AES.cpp:(.text._ZN8CryptoPP19BlockTransformationC2Ev[_ZN8CryptoPP19BlockTransformationC5Ev]+0x1e): undefined reference to `vtable for CryptoPP::BlockTransformation'
/tmp/cczoSf1S.o: In function `CryptoPP::Rijndael::Base::Base()':
AES.cpp:(.text._ZN8CryptoPP8Rijndael4BaseC2Ev[_ZN8CryptoPP8Rijndael4BaseC5Ev]+0x17): undefined reference to `vtable for CryptoPP::Rijndael::Base'
AES.cpp:(.text._ZN8CryptoPP8Rijndael4BaseC2Ev[_ZN8CryptoPP8Rijndael4BaseC5Ev]+0x21): undefined reference to `vtable for CryptoPP::Rijndael::Base'
/tmp/cczoSf1S.o: In function `CryptoPP::Rijndael::Enc::Enc()':
AES.cpp:(.text._ZN8CryptoPP8Rijndael3EncC2Ev[_ZN8CryptoPP8Rijndael3EncC5Ev]+0x16): undefined reference to `vtable for CryptoPP::Rijndael::Enc'
AES.cpp:(.text._ZN8CryptoPP8Rijndael3EncC2Ev[_ZN8CryptoPP8Rijndael3EncC5Ev]+0x20): undefined reference to `vtable for CryptoPP::Rijndael::Enc'
/tmp/cczoSf1S.o: In function `CryptoPP::BlockCipherFinal<(CryptoPP::CipherDir)0, CryptoPP::Rijndael::Enc>::BlockCipherFinal(unsigned char const*, unsigned int)':
AES.cpp:(.text._ZN8CryptoPP16BlockCipherFinalILNS_9CipherDirE0ENS_8Rijndael3EncEEC2EPKhj[_ZN8CryptoPP16BlockCipherFinalILNS_9CipherDirE0ENS_8Rijndael3EncEEC5EPKhj]+0x27): undefined reference to `CryptoPP::g_nullNameValuePairs'
AES.cpp:(.text._ZN8CryptoPP16BlockCipherFinalILNS_9CipherDirE0ENS_8Rijndael3EncEEC2EPKhj[_ZN8CryptoPP16BlockCipherFinalILNS_9CipherDirE0ENS_8Rijndael3EncEEC5EPKhj]+0x44): undefined reference to `CryptoPP::SimpleKeyingInterface::SetKey(unsigned char const*, unsigned int, CryptoPP::NameValuePairs const&)'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP16BlockCipherFinalILNS_9CipherDirE0ENS_8Rijndael3EncEEE[vtable for CryptoPP::BlockCipherFinal<(CryptoPP::CipherDir)0, CryptoPP::Rijndael::Enc>]+0x24): undefined reference to `CryptoPP::SimpleKeyingInterface::SetKey(unsigned char const*, unsigned int, CryptoPP::NameValuePairs const&)'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP16BlockCipherFinalILNS_9CipherDirE0ENS_8Rijndael3EncEEE[vtable for CryptoPP::BlockCipherFinal<(CryptoPP::CipherDir)0, CryptoPP::Rijndael::Enc>]+0x3c): undefined reference to `CryptoPP::SimpleKeyingInterface::GetNextIV(CryptoPP::RandomNumberGenerator&, unsigned char*)'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP16BlockCipherFinalILNS_9CipherDirE0ENS_8Rijndael3EncEEE[vtable for CryptoPP::BlockCipherFinal<(CryptoPP::CipherDir)0, CryptoPP::Rijndael::Enc>]+0x44): undefined reference to `CryptoPP::Rijndael::Base::UncheckedSetKey(unsigned char const*, unsigned int, CryptoPP::NameValuePairs const&)'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP16BlockCipherFinalILNS_9CipherDirE0ENS_8Rijndael3EncEEE[vtable for CryptoPP::BlockCipherFinal<(CryptoPP::CipherDir)0, CryptoPP::Rijndael::Enc>]+0x50): undefined reference to `CryptoPP::Rijndael::Enc::ProcessAndXorBlock(unsigned char const*, unsigned char const*, unsigned char*) const'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP16BlockCipherFinalILNS_9CipherDirE0ENS_8Rijndael3EncEEE[vtable for CryptoPP::BlockCipherFinal<(CryptoPP::CipherDir)0, CryptoPP::Rijndael::Enc>]+0x54): undefined reference to `CryptoPP::Rijndael::Enc::AdvancedProcessBlocks(unsigned char const*, unsigned char const*, unsigned char*, unsigned int, unsigned int) const'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP16BlockCipherFinalILNS_9CipherDirE0ENS_8Rijndael3EncEEE[vtable for CryptoPP::BlockCipherFinal<(CryptoPP::CipherDir)0, CryptoPP::Rijndael::Enc>]+0x78): undefined reference to `non-virtual thunk to CryptoPP::Rijndael::Enc::ProcessAndXorBlock(unsigned char const*, unsigned char const*, unsigned char*) const'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP16BlockCipherFinalILNS_9CipherDirE0ENS_8Rijndael3EncEEE[vtable for CryptoPP::BlockCipherFinal<(CryptoPP::CipherDir)0, CryptoPP::Rijndael::Enc>]+0x80): undefined reference to `CryptoPP::BlockTransformation::OptimalDataAlignment() const'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP16BlockCipherFinalILNS_9CipherDirE0ENS_8Rijndael3EncEEE[vtable for CryptoPP::BlockCipherFinal<(CryptoPP::CipherDir)0, CryptoPP::Rijndael::Enc>]+0x90): undefined reference to `non-virtual thunk to CryptoPP::Rijndael::Enc::AdvancedProcessBlocks(unsigned char const*, unsigned char const*, unsigned char*, unsigned int, unsigned int) const'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP12ClonableImplINS_16BlockCipherFinalILNS_9CipherDirE0ENS_8Rijndael3EncEEES4_EE[vtable for CryptoPP::ClonableImpl<CryptoPP::BlockCipherFinal<(CryptoPP::CipherDir)0, CryptoPP::Rijndael::Enc>, CryptoPP::Rijndael::Enc>]+0x24): undefined reference to `CryptoPP::SimpleKeyingInterface::SetKey(unsigned char const*, unsigned int, CryptoPP::NameValuePairs const&)'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP12ClonableImplINS_16BlockCipherFinalILNS_9CipherDirE0ENS_8Rijndael3EncEEES4_EE[vtable for CryptoPP::ClonableImpl<CryptoPP::BlockCipherFinal<(CryptoPP::CipherDir)0, CryptoPP::Rijndael::Enc>, CryptoPP::Rijndael::Enc>]+0x3c): undefined reference to `CryptoPP::SimpleKeyingInterface::GetNextIV(CryptoPP::RandomNumberGenerator&, unsigned char*)'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP12ClonableImplINS_16BlockCipherFinalILNS_9CipherDirE0ENS_8Rijndael3EncEEES4_EE[vtable for CryptoPP::ClonableImpl<CryptoPP::BlockCipherFinal<(CryptoPP::CipherDir)0, CryptoPP::Rijndael::Enc>, CryptoPP::Rijndael::Enc>]+0x44): undefined reference to `CryptoPP::Rijndael::Base::UncheckedSetKey(unsigned char const*, unsigned int, CryptoPP::NameValuePairs const&)'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP12ClonableImplINS_16BlockCipherFinalILNS_9CipherDirE0ENS_8Rijndael3EncEEES4_EE[vtable for CryptoPP::ClonableImpl<CryptoPP::BlockCipherFinal<(CryptoPP::CipherDir)0, CryptoPP::Rijndael::Enc>, CryptoPP::Rijndael::Enc>]+0x50): undefined reference to `CryptoPP::Rijndael::Enc::ProcessAndXorBlock(unsigned char const*, unsigned char const*, unsigned char*) const'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP12ClonableImplINS_16BlockCipherFinalILNS_9CipherDirE0ENS_8Rijndael3EncEEES4_EE[vtable for CryptoPP::ClonableImpl<CryptoPP::BlockCipherFinal<(CryptoPP::CipherDir)0, CryptoPP::Rijndael::Enc>, CryptoPP::Rijndael::Enc>]+0x54): undefined reference to `CryptoPP::Rijndael::Enc::AdvancedProcessBlocks(unsigned char const*, unsigned char const*, unsigned char*, unsigned int, unsigned int) const'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP12ClonableImplINS_16BlockCipherFinalILNS_9CipherDirE0ENS_8Rijndael3EncEEES4_EE[vtable for CryptoPP::ClonableImpl<CryptoPP::BlockCipherFinal<(CryptoPP::CipherDir)0, CryptoPP::Rijndael::Enc>, CryptoPP::Rijndael::Enc>]+0x74): undefined reference to `non-virtual thunk to CryptoPP::Rijndael::Enc::ProcessAndXorBlock(unsigned char const*, unsigned char const*, unsigned char*) const'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP12ClonableImplINS_16BlockCipherFinalILNS_9CipherDirE0ENS_8Rijndael3EncEEES4_EE[vtable for CryptoPP::ClonableImpl<CryptoPP::BlockCipherFinal<(CryptoPP::CipherDir)0, CryptoPP::Rijndael::Enc>, CryptoPP::Rijndael::Enc>]+0x7c): undefined reference to `CryptoPP::BlockTransformation::OptimalDataAlignment() const'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP12ClonableImplINS_16BlockCipherFinalILNS_9CipherDirE0ENS_8Rijndael3EncEEES4_EE[vtable for CryptoPP::ClonableImpl<CryptoPP::BlockCipherFinal<(CryptoPP::CipherDir)0, CryptoPP::Rijndael::Enc>, CryptoPP::Rijndael::Enc>]+0x8c): undefined reference to `non-virtual thunk to CryptoPP::Rijndael::Enc::AdvancedProcessBlocks(unsigned char const*, unsigned char const*, unsigned char*, unsigned int, unsigned int) const'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP15BlockCipherImplINS_13Rijndael_InfoENS_11BlockCipherEEE[vtable for CryptoPP::BlockCipherImpl<CryptoPP::Rijndael_Info, CryptoPP::BlockCipher>]+0x24): undefined reference to `CryptoPP::SimpleKeyingInterface::SetKey(unsigned char const*, unsigned int, CryptoPP::NameValuePairs const&)'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP15BlockCipherImplINS_13Rijndael_InfoENS_11BlockCipherEEE[vtable for CryptoPP::BlockCipherImpl<CryptoPP::Rijndael_Info, CryptoPP::BlockCipher>]+0x3c): undefined reference to `CryptoPP::SimpleKeyingInterface::GetNextIV(CryptoPP::RandomNumberGenerator&, unsigned char*)'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP15BlockCipherImplINS_13Rijndael_InfoENS_11BlockCipherEEE[vtable for CryptoPP::BlockCipherImpl<CryptoPP::Rijndael_Info, CryptoPP::BlockCipher>]+0x70): undefined reference to `CryptoPP::BlockTransformation::OptimalDataAlignment() const'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP15BlockCipherImplINS_13Rijndael_InfoENS_11BlockCipherEEE[vtable for CryptoPP::BlockCipherImpl<CryptoPP::Rijndael_Info, CryptoPP::BlockCipher>]+0x80): undefined reference to `CryptoPP::BlockTransformation::AdvancedProcessBlocks(unsigned char const*, unsigned char const*, unsigned char*, unsigned int, unsigned int) const'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP13AlgorithmImplINS_25SimpleKeyingInterfaceImplINS_8TwoBasesINS_11BlockCipherENS_13Rijndael_InfoEEES5_EES6_EE[vtable for CryptoPP::AlgorithmImpl<CryptoPP::SimpleKeyingInterfaceImpl<CryptoPP::TwoBases<CryptoPP::BlockCipher, CryptoPP::Rijndael_Info>, CryptoPP::TwoBases<CryptoPP::BlockCipher, CryptoPP::Rijndael_Info> >, CryptoPP::SimpleKeyingInterfaceImpl<CryptoPP::TwoBases<CryptoPP::BlockCipher, CryptoPP::Rijndael_Info>, CryptoPP::TwoBases<CryptoPP::BlockCipher, CryptoPP::Rijndael_Info> > >]+0x24): undefined reference to `CryptoPP::SimpleKeyingInterface::SetKey(unsigned char const*, unsigned int, CryptoPP::NameValuePairs const&)'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP13AlgorithmImplINS_25SimpleKeyingInterfaceImplINS_8TwoBasesINS_11BlockCipherENS_13Rijndael_InfoEEES5_EES6_EE[vtable for CryptoPP::AlgorithmImpl<CryptoPP::SimpleKeyingInterfaceImpl<CryptoPP::TwoBases<CryptoPP::BlockCipher, CryptoPP::Rijndael_Info>, CryptoPP::TwoBases<CryptoPP::BlockCipher, CryptoPP::Rijndael_Info> >, CryptoPP::SimpleKeyingInterfaceImpl<CryptoPP::TwoBases<CryptoPP::BlockCipher, CryptoPP::Rijndael_Info>, CryptoPP::TwoBases<CryptoPP::BlockCipher, CryptoPP::Rijndael_Info> > >]+0x3c): undefined reference to `CryptoPP::SimpleKeyingInterface::GetNextIV(CryptoPP::RandomNumberGenerator&, unsigned char*)'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP13AlgorithmImplINS_25SimpleKeyingInterfaceImplINS_8TwoBasesINS_11BlockCipherENS_13Rijndael_InfoEEES5_EES6_EE[vtable for CryptoPP::AlgorithmImpl<CryptoPP::SimpleKeyingInterfaceImpl<CryptoPP::TwoBases<CryptoPP::BlockCipher, CryptoPP::Rijndael_Info>, CryptoPP::TwoBases<CryptoPP::BlockCipher, CryptoPP::Rijndael_Info> >, CryptoPP::SimpleKeyingInterfaceImpl<CryptoPP::TwoBases<CryptoPP::BlockCipher, CryptoPP::Rijndael_Info>, CryptoPP::TwoBases<CryptoPP::BlockCipher, CryptoPP::Rijndael_Info> > >]+0x6c): undefined reference to `CryptoPP::BlockTransformation::OptimalDataAlignment() const'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP13AlgorithmImplINS_25SimpleKeyingInterfaceImplINS_8TwoBasesINS_11BlockCipherENS_13Rijndael_InfoEEES5_EES6_EE[vtable for CryptoPP::AlgorithmImpl<CryptoPP::SimpleKeyingInterfaceImpl<CryptoPP::TwoBases<CryptoPP::BlockCipher, CryptoPP::Rijndael_Info>, CryptoPP::TwoBases<CryptoPP::BlockCipher, CryptoPP::Rijndael_Info> >, CryptoPP::SimpleKeyingInterfaceImpl<CryptoPP::TwoBases<CryptoPP::BlockCipher, CryptoPP::Rijndael_Info>, CryptoPP::TwoBases<CryptoPP::BlockCipher, CryptoPP::Rijndael_Info> > >]+0x7c): undefined reference to `CryptoPP::BlockTransformation::AdvancedProcessBlocks(unsigned char const*, unsigned char const*, unsigned char*, unsigned int, unsigned int) const'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP25SimpleKeyingInterfaceImplINS_8TwoBasesINS_11BlockCipherENS_13Rijndael_InfoEEES4_EE[vtable for CryptoPP::SimpleKeyingInterfaceImpl<CryptoPP::TwoBases<CryptoPP::BlockCipher, CryptoPP::Rijndael_Info>, CryptoPP::TwoBases<CryptoPP::BlockCipher, CryptoPP::Rijndael_Info> >]+0x24): undefined reference to `CryptoPP::SimpleKeyingInterface::SetKey(unsigned char const*, unsigned int, CryptoPP::NameValuePairs const&)'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP25SimpleKeyingInterfaceImplINS_8TwoBasesINS_11BlockCipherENS_13Rijndael_InfoEEES4_EE[vtable for CryptoPP::SimpleKeyingInterfaceImpl<CryptoPP::TwoBases<CryptoPP::BlockCipher, CryptoPP::Rijndael_Info>, CryptoPP::TwoBases<CryptoPP::BlockCipher, CryptoPP::Rijndael_Info> >]+0x3c): undefined reference to `CryptoPP::SimpleKeyingInterface::GetNextIV(CryptoPP::RandomNumberGenerator&, unsigned char*)'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP25SimpleKeyingInterfaceImplINS_8TwoBasesINS_11BlockCipherENS_13Rijndael_InfoEEES4_EE[vtable for CryptoPP::SimpleKeyingInterfaceImpl<CryptoPP::TwoBases<CryptoPP::BlockCipher, CryptoPP::Rijndael_Info>, CryptoPP::TwoBases<CryptoPP::BlockCipher, CryptoPP::Rijndael_Info> >]+0x68): undefined reference to `CryptoPP::BlockTransformation::OptimalDataAlignment() const'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP25SimpleKeyingInterfaceImplINS_8TwoBasesINS_11BlockCipherENS_13Rijndael_InfoEEES4_EE[vtable for CryptoPP::SimpleKeyingInterfaceImpl<CryptoPP::TwoBases<CryptoPP::BlockCipher, CryptoPP::Rijndael_Info>, CryptoPP::TwoBases<CryptoPP::BlockCipher, CryptoPP::Rijndael_Info> >]+0x78): undefined reference to `CryptoPP::BlockTransformation::AdvancedProcessBlocks(unsigned char const*, unsigned char const*, unsigned char*, unsigned int, unsigned int) const'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP8TwoBasesINS_11BlockCipherENS_13Rijndael_InfoEEE[vtable for CryptoPP::TwoBases<CryptoPP::BlockCipher, CryptoPP::Rijndael_Info>]+0x24): undefined reference to `CryptoPP::SimpleKeyingInterface::SetKey(unsigned char const*, unsigned int, CryptoPP::NameValuePairs const&)'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP8TwoBasesINS_11BlockCipherENS_13Rijndael_InfoEEE[vtable for CryptoPP::TwoBases<CryptoPP::BlockCipher, CryptoPP::Rijndael_Info>]+0x3c): undefined reference to `CryptoPP::SimpleKeyingInterface::GetNextIV(CryptoPP::RandomNumberGenerator&, unsigned char*)'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP8TwoBasesINS_11BlockCipherENS_13Rijndael_InfoEEE[vtable for CryptoPP::TwoBases<CryptoPP::BlockCipher, CryptoPP::Rijndael_Info>]+0x68): undefined reference to `CryptoPP::BlockTransformation::OptimalDataAlignment() const'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP8TwoBasesINS_11BlockCipherENS_13Rijndael_InfoEEE[vtable for CryptoPP::TwoBases<CryptoPP::BlockCipher, CryptoPP::Rijndael_Info>]+0x78): undefined reference to `CryptoPP::BlockTransformation::AdvancedProcessBlocks(unsigned char const*, unsigned char const*, unsigned char*, unsigned int, unsigned int) const'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP11BlockCipherE[vtable for CryptoPP::BlockCipher]+0x24): undefined reference to `CryptoPP::SimpleKeyingInterface::SetKey(unsigned char const*, unsigned int, CryptoPP::NameValuePairs const&)'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP11BlockCipherE[vtable for CryptoPP::BlockCipher]+0x3c): undefined reference to `CryptoPP::SimpleKeyingInterface::GetNextIV(CryptoPP::RandomNumberGenerator&, unsigned char*)'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP11BlockCipherE[vtable for CryptoPP::BlockCipher]+0x68): undefined reference to `CryptoPP::BlockTransformation::OptimalDataAlignment() const'
/tmp/cczoSf1S.o:(.rodata._ZTVN8CryptoPP11BlockCipherE[vtable for CryptoPP::BlockCipher]+0x78): undefined reference to `CryptoPP::BlockTransformation::AdvancedProcessBlocks(unsigned char const*, unsigned char const*, unsigned char*, unsigned int, unsigned int) const'
/tmp/cczoSf1S.o:(.rodata._ZTIN8CryptoPP12ClonableImplINS_16BlockCipherFinalILNS_9CipherDirE0ENS_8Rijndael3EncEEES4_EE[typeinfo for CryptoPP::ClonableImpl<CryptoPP::BlockCipherFinal<(CryptoPP::CipherDir)0, CryptoPP::Rijndael::Enc>, CryptoPP::Rijndael::Enc>]+0x8): undefined reference to `typeinfo for CryptoPP::Rijndael::Enc'
/tmp/cczoSf1S.o:(.rodata._ZTIN8CryptoPP11BlockCipherE[typeinfo for CryptoPP::BlockCipher]+0x10): undefined reference to `typeinfo for CryptoPP::SimpleKeyingInterface'
/tmp/cczoSf1S.o:(.rodata._ZTIN8CryptoPP11BlockCipherE[typeinfo for CryptoPP::BlockCipher]+0x18): undefined reference to `typeinfo for CryptoPP::BlockTransformation'
/tmp/cczoSf1S.o: In function `CryptoPP::SimpleKeyingInterface::SimpleKeyingInterface(CryptoPP::SimpleKeyingInterface const&)':
AES.cpp:(.text._ZN8CryptoPP21SimpleKeyingInterfaceC2ERKS0_[_ZN8CryptoPP21SimpleKeyingInterfaceC5ERKS0_]+0x8): undefined reference to `vtable for CryptoPP::SimpleKeyingInterface'
/tmp/cczoSf1S.o: In function `CryptoPP::BlockTransformation::BlockTransformation(CryptoPP::BlockTransformation const&)':
AES.cpp:(.text._ZN8CryptoPP19BlockTransformationC2ERKS0_[_ZN8CryptoPP19BlockTransformationC5ERKS0_]+0x1d): undefined reference to `vtable for CryptoPP::BlockTransformation'
/tmp/cczoSf1S.o: In function `CryptoPP::Rijndael::Base::Base(CryptoPP::Rijndael::Base const&)':
AES.cpp:(.text._ZN8CryptoPP8Rijndael4BaseC2ERKS1_[_ZN8CryptoPP8Rijndael4BaseC5ERKS1_]+0x1e): undefined reference to `vtable for CryptoPP::Rijndael::Base'
AES.cpp:(.text._ZN8CryptoPP8Rijndael4BaseC2ERKS1_[_ZN8CryptoPP8Rijndael4BaseC5ERKS1_]+0x28): undefined reference to `vtable for CryptoPP::Rijndael::Base'
/tmp/cczoSf1S.o: In function `CryptoPP::Rijndael::Enc::Enc(CryptoPP::Rijndael::Enc const&)':
AES.cpp:(.text._ZN8CryptoPP8Rijndael3EncC2ERKS1_[_ZN8CryptoPP8Rijndael3EncC5ERKS1_]+0x1d): undefined reference to `vtable for CryptoPP::Rijndael::Enc'
AES.cpp:(.text._ZN8CryptoPP8Rijndael3EncC2ERKS1_[_ZN8CryptoPP8Rijndael3EncC5ERKS1_]+0x27): undefined reference to `vtable for CryptoPP::Rijndael::Enc'
collect2: ld returned 1 exit status
[Finished in 0.7s with exit code 1]
[shell_cmd: g++ "/home/jack/Desktop/Crytpo C++/AES.cpp" -o "/home/jack/Desktop/Crytpo C++/AES"]
[dir: /home/jack/Desktop/Crytpo C++]
[path: /usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games]

I tried putting in the lines 1 at a time, then building and it seems to start getting errors at creating the cipher text.

Это было полезно?

Решение

How do you compile your project? It seems you did not link crypto++ library. If you are using gcc you can add -lcrypto++ to compile options.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top