| Server IP : 146.59.209.152 / Your IP : 216.73.216.46 Web Server : Apache System : Linux webm005.cluster131.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64 User : infrafs ( 43850) PHP Version : 8.2.29 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/infrafs/INFRABIKEUS/wp-content/plugins/wpvivid-backup-mainwp/includes/ |
Upload File : |
<?php
if (!defined('MAINWP_WPVIVID_EXTENSION_PLUGIN_DIR')){
die;
}
class Mainwp_WPvivid_crypt
{
private $public_key;
private $sym_key;
private $rij;
private $rsa;
public function __construct($public_key)
{
$this->public_key=$public_key;
include_once MAINWP_WPVIVID_EXTENSION_PLUGIN_DIR . '/vendor/autoload.php';
$this->rij= new Crypt_Rijndael();
$this->rsa= new Crypt_RSA();
}
public function generate_key()
{
$this->sym_key = crypt_random_string(32);
$this->rij->setKey($this->sym_key);
}
public function encrypt_message($message)
{
$this->generate_key();
$key=$this->encrypt_key();
$len=str_pad(dechex(strlen($key)),3,'0', STR_PAD_LEFT);
$message=$this->rij->encrypt($message);
if($message===false)
return false;
$message_len = str_pad(dechex(strlen($message)), 16, '0', STR_PAD_LEFT);
return $len.$key.$message_len.$message;
}
public function encrypt_key()
{
$this->rsa->loadKey($this->public_key);
return $this->rsa->encrypt($this->sym_key);
}
public function decrypt_message($message)
{
$len = substr($message, 0, 3);
$len = hexdec($len);
$key = substr($message, 3, $len);
$cipherlen = substr($message, ($len + 3), 16);
$cipherlen = hexdec($cipherlen);
$data = substr($message, ($len + 19), $cipherlen);
$rsa = new Crypt_RSA();
$rsa->loadKey($this->public_key);
$key=$rsa->decrypt($key);
$rij = new Crypt_Rijndael();
$rij->setKey($key);
return $rij->decrypt($data);
}
public function encrypt_user_info($email,$pw)
{
$user_info['user']=$email;
$user_info['pw']=$pw;
$info=wp_json_encode($user_info);
$this->rsa->loadKey($this->public_key);
return $this->rsa->encrypt($info);
}
public function encrypt_user_token($token)
{
$user_info['token']=$token;
$info=wp_json_encode($user_info);
$this->rsa->loadKey($this->public_key);
return $this->rsa->encrypt($info);
}
}