|
@@ -44,6 +44,8 @@ class OriginBank
|
|
|
dump($data);
|
|
|
$base_data['data'] = $this->encrypt(json_encode($data),$this->open_key);
|
|
|
dump($data);
|
|
|
+
|
|
|
+ dump($this->decrypt($base_data['data'],$this->open_key));
|
|
|
$base_data['sign'] = $this->signs($data);
|
|
|
|
|
|
dump('base_data');dump($base_data);
|
|
@@ -110,4 +112,19 @@ class OriginBank
|
|
|
$pad = $blocksize - (strlen($text) % $blocksize);
|
|
|
return $text . str_repeat(chr($pad), $pad);
|
|
|
}
|
|
|
+
|
|
|
+ public function decrypt($sStr, $sKey) {
|
|
|
+ $sStr=hex2bin($sStr);
|
|
|
+ $decrypted= mcrypt_decrypt(
|
|
|
+ MCRYPT_RIJNDAEL_128,
|
|
|
+ $sKey,
|
|
|
+ $sStr,
|
|
|
+ MCRYPT_MODE_ECB
|
|
|
+ );
|
|
|
+
|
|
|
+ $dec_s = strlen($decrypted);
|
|
|
+ $padding = ord($decrypted[$dec_s-1]);
|
|
|
+ $decrypted = substr($decrypted, 0, -$padding);
|
|
|
+ return $decrypted;
|
|
|
+ }
|
|
|
}
|