I have encrypted a plain text using openssl_encrypt method in php. The code is given below.
$plain_text = 'hello world';
$password = '1224567892abcdef1231567390a1cde2';
$iv = '3234367890fbceef';
$options = OPENSSL_RAW_DATA;
$enc_data = bin2hex(openssl_encrypt($plain_text, 'aes-256-ctr', $password, $options, $iv));
echo $enc_data;
This php code generates this encrypted string: 3fd4e82b5c21ad4c2abd74
And for decrypting I am using this php code:
$plain_text = openssl_decrypt(hex2bin($enc_data), 'aes-256-ctr', $password, $options, $iv);
But I want to decrypt this encrypted code using unix command in terminal. Could anyone help me on this?
I have tried with this command:
echo -n "3fd4e82b5c21ad4c2abd74" | xxd -r -p | openssl enc -aes-256-ctr -K 1224567892abcdef1231567390a1cde2 -iv 3234367890fbceef -d -nosalt
But I am not getting the expected plain text.
I am looking for some unix command using which I can get the decrypted plain text.