|
@@ -42,10 +42,10 @@ class OriginBank
|
|
|
$data['ord_name'] = "购买物品订单名称";
|
|
|
|
|
|
dump($data);
|
|
|
- $base_data['data'] = $this->encrypt(json_encode($data),$this->open_key);
|
|
|
+ $base_data['data'] = $this->encrypt2(json_encode($data),$this->open_key);
|
|
|
dump($data);
|
|
|
|
|
|
- dump($this->decrypt($base_data['data'],$this->open_key));
|
|
|
+ dump($this->decrypt2($base_data['data'],$this->open_key));
|
|
|
$base_data['sign'] = $this->signs($data);
|
|
|
|
|
|
dump('base_data');dump($base_data);
|
|
@@ -108,6 +108,19 @@ class OriginBank
|
|
|
return $data;
|
|
|
}
|
|
|
|
|
|
+ public function encrypt2($input, $key)
|
|
|
+ {
|
|
|
+ $data = openssl_encrypt($input, 'AES-128-ECB', $key, OPENSSL_RAW_DATA);
|
|
|
+ $data = base64_encode($data);
|
|
|
+ return $data;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function decrypt2($sStr, $sKey)
|
|
|
+ {
|
|
|
+ $decrypted = openssl_decrypt(base64_decode($sStr), 'AES-128-ECB', $sKey, OPENSSL_RAW_DATA);
|
|
|
+ return $decrypted;
|
|
|
+ }
|
|
|
+
|
|
|
private function pkcs5_pad ($text, $blocksize) {
|
|
|
$pad = $blocksize - (strlen($text) % $blocksize);
|
|
|
return $text . str_repeat(chr($pad), $pad);
|