What is the openssl command line for decrypting text encrypted using the following php code?
function encrypt($text, $key) {
return trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $text, MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))));
}
This is how far I got:
"blah blah" encrypted with "password" becomes:
whSklKP6+wJdbGpiaCavFp8BiaZ6B1LZmJ0d7Nqx2nc=
I try and decrypt this with:
openssl base64 -d -in test.b64 > test.bin
openssl enc -d -aes-256-ecb -pass pass:password -in test.bin -out test.txt
And I get:
bad magic number