3ign0n / CryptoPP-for-iOS

iOS porting of http://www.cryptopp.com/ and some example code
25 stars 12 forks source link

linker error #2

Open minusplusminus opened 10 years ago

minusplusminus commented 10 years ago

Hi thanks for this wonderful sollution. But I get an linker error:

"CryptoPP::StringSinkTemplatestd::string::StringSinkTemplate(std::string&)", referenced from:

Even more when I add more headers.

Here's my code:

 static string decryptAES(string toDecrypt, string keyStr)
     {
       byte key[ CryptoPP::AES::DEFAULT_KEYLENGTH ];
      byte iv[ CryptoPP::AES::BLOCKSIZE ];

    ::memset( iv, 0x01, CryptoPP::AES::BLOCKSIZE );
    for(int x=0; x< CryptoPP::AES::DEFAULT_KEYLENGTH; x++)
    {
        key[x] = keyStr[x];
    }
    std::string decryptedtext;

    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 ) );

    int len = toDecrypt.length();
    stfDecryptor.Put( reinterpret_cast<const unsigned char*>(toDecrypt.c_str()), len + 1);
    stfDecryptor.MessageEnd();

    return decryptedtext;
}