InToSSH

Barton encrypt/decrypt

Feb 2nd, 2021
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.58 KB | None | 0 0
  1. function pay_encrypt($json_data, $key, $iv)
  2. {
  3.  
  4.     $encryption_key = base64_decode($key);
  5.     $iv_orig = base64_decode($iv);
  6.     $sdata = serialize($json_data);
  7.     $encrypted = openssl_encrypt($sdata, 'aes-256-cbc', $encryption_key, 0, $iv_orig);
  8.  
  9.     return strtr($encrypted, '+/=', '._-');
  10. }
  11.  
  12.  
  13. function pay_decrypt($data, $key, $iv)
  14. {
  15.  
  16.     $encryption_key = base64_decode($key);
  17.     $iv_orig = base64_decode($iv);
  18.     $data_unsanitized = strtr($data, '._-', '+/=');
  19.  
  20.     return unserialize(openssl_decrypt($data_unsanitized, 'aes-256-cbc', $encryption_key, 0, $iv_orig));
  21. }
Add Comment
Please, Sign In to add comment