I have compiled Crypto++ 700 for Visual Studio 2013 using the delivered 
.sln file (once as is and once explicitly using v120 toolset and /MD).

I am able to compile, link and run succesffully this sample code, taken 
from : https://stackoverflow.com/a/12307096/2393191


#include <iostream>
#include <iomanip>

#include "modes.h"
#include "aes.h"
#include "filters.h"



//#include "cryptlib.h"

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
    CryptoPP::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<CryptoPP::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;

    std::cin.get();

    return 0;
}

But as soon as I add

*CryptoPP::RSASSA_PKCS1v15_SHA_Signer priv;*

and the necessary


*#include <des.h>#include <rsa.h>*

to that code, I am obersving linking errors for unresolved external symbols:

error LNK2001: Nicht aufgelöstes externes Symbol ""public: static unsigned 
int const CryptoPP::PKCS_DigestDecoration<class CryptoPP::SHA1>::length" 
(?length@?$PKCS_DigestDecoration@VSHA1@CryptoPP@@@CryptoPP@@2IB)".
error LNK2001: Nicht aufgelöstes externes Symbol ""public: static unsigned 
char const * const CryptoPP::PKCS_DigestDecoration<class 
CryptoPP::SHA1>::decoration" 
(?decoration@?$PKCS_DigestDecoration@VSHA1@CryptoPP@@@CryptoPP@@2QBEB)".




Any idea where to search? I already compiled crypto++ with Unicode and 
MT/MD without any changes in the result. I think I'm linking correctly and 
since the first example works fine, I think the library should be 
compatible to my project.

-- 
You received this message because you are subscribed to "Crypto++ Users". More 
information about Crypto++ and this group is available at 
http://www.cryptopp.com and 
http://groups.google.com/forum/#!forum/cryptopp-users.
--- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to