CryptOpensslAes.php class CryptOpensslAes{ const AES_METHOD = 'AES-128-ECB'; private $secretKey = ''; private $signKey = ''; public function __construct($secretKey,$signKey){ $this-secretKey = $secretKey; $this-signKey = $signKey; } /** * 解
class CryptOpensslAes { const AES_METHOD = 'AES-128-ECB'; private $secretKey = ''; private $signKey = ''; public function __construct($secretKey,$signKey){ $this->secretKey = $secretKey; $this->signKey = $signKey; } /** * 解密 * @param $secretData * @return string */ public function decode($secretData){ return openssl_decrypt($secretData, self::AES_METHOD, $this->secretKey, false); } /** * 加密 * @param $data * @return string */ public function encode($data){ return openssl_encrypt($data, self::AES_METHOD, $this->secretKey, false); } /** * 签名 * @param $data * @return string */ public function sign($data){ return md5($data.$this->signKey); } /** * 检测签名 * @param $data * @param $sign * @return bool */ public function checkSign($data,$sign){ return $this->sign($data) == $sign; } }