现在的需求是,有数据要用php加密(对称的), 而另一个解密的程序用的是openssl的库下面代码测试是用aes加密后保存到文件, 然后用openssl测试能否解开,结果老是解密失败,不知道是什么key参数不一致还是什么原因。---或者告诉我用什么其他的php加密代码,openssl能解开的就好!set_include_path('./phpseclib0.2.1a'); //http://phpseclib.sourceforge.net/
include('Crypt/AES.php');$plaintext = 'PLAINTEXT';$aes = new Crypt_AES(CRYPT_AES_MODE_CBC);
$aes->setKey('1234123412341234');
$ciphertext = $aes->encrypt($plaintext);
$fp = fopen("ciphertextAES", "wb");
fwrite($fp, $ciphertext);
fclose($fp);
openssl enc -aes-128-cbc -d -in ciphertextAES -out plaintext.txt -pass pass:1234123412341234 -nosalt
bad decrypt
3840:error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt:.\crypto\evp\evp_enc.c:466: