说明:128位AES, ECB模式,ZeroBytePadding填充,加密后,使用bin2hex( entry接口用户密码加密使用)
aes 加密,解密
public function ex_aestest()
{
$ckey = $_POST['key'];//企业Key
$chairmansourcepwd = $POST['pwd'];//用户密码
$chairmanPWD = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $ckey, $chairmansourcepwd, MCRYPT_MODE_ECB);
var_dump('encrypt:');
var_dump(bin2hex($chairmanPWD));
$bin_str = pack("H*" , bin2hex($chairmanPWD));
$orgtext = trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $ckey, $bin_str, MCRYPT_MODE_ECB));
var_dump('decrypt:');
var_dump($orgtext);
}