CryptoPP-for-iOS
CryptoPP-for-iOS copied to clipboard
linker error
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;
}