OpenSSL用PHP加密,用exe解密

时间:2016-08-17 07:43:51

标签: php encryption openssl cryptography

我有一个问题,用openssl.exe解密一个用" openssl_encrypt()"加密的字符串。

我用PHP加密我的字符串,如下所示:

$string = 'This is a test.';
$pass = '123ThisIsAPass987';
$method = 'bf-cbc';
$options = OPENSSL_RAW_DATA;
$iv = 23693999;

echo "iv (hex): ".unpack("H*", $iv)[1];
echo "<br>pass (hex): ".unpack("H*", $pass)[1];
echo "<br>";

file_put_contents('./file.encrypted', openssl_encrypt($string, $method, $pass, $options, $iv));

当我用这个命令解密时,我得不到正确的结果:

  

openssl.exe enc -bf-cbc -d -in file.encrypted -out file.decrypted -naltalt -nopad -K 3132335468697349734150617373393837 -iv 3233363933393939

感谢您的帮助。

0 个答案:

没有答案