im having issues encryption/decryption different cipher suites.
on 1 hand, using php encrypt string:
base64_encode(openssl_encrypt($data, "aes-128-cbc", $password, openssl_raw_data, "0123456789abdefg"));
and on other hand, decrypting cryptopp:
std::string decrypted = decrypt(dl_notdecrypted, decryption_key, "0123456789abdefg");
the function "decrypt":
std::string decrypt(const std::string& str_in, const std::string& key, const std::string& iv) { std::string str_out; cryptopp::cbc_mode<cryptopp::aes>::decryption decryption((byte*)key.c_str(), key.length(), (byte*)iv.c_str()); cryptopp::stringsource decryptor(str_in, true, new cryptopp::base64decoder( new cryptopp::streamtransformationfilter(decryption, new cryptopp::stringsink(str_out) ) ) ); return str_out; }
it fails "unknown exception". guessing padding issue openssl, have no clue how supposed fix this.
if there available this, nice. thanks.
Comments
Post a Comment