Reputation: 23581
I'm using the following method to decrypt the data,
$clear = openssl_decrypt($data, 'aes-256-cbc', $pass, 0, $iv);
$iv
is always null, but it works
But when I use openssl to decrypt the same file (the data is base64 encoded),
openssl aes-256-cbc -d -a -in encrypted
After inputing the password, it says error reading input file
, totally weird error
Any ideas?
Upvotes: 0
Views: 121
Reputation: 61952
In PHP $pass
is actually the full binary key. The openssl utility expects the actual password. You might want to use
openssl aes-256-cbc -d -a -in encrypted -K <hex-encoded key> -nosalt -iv 00000000000000000000000000000000
Upvotes: 1