Repository URL to install this package:
|
Version:
1.3.5 ▾
|
<?php
namespace Drupal\custom_forms;
use phpseclib\Crypt\AES;
/**
* Class AESEncryption
*
* Functionality class that enabled encrypting and decrypting using AES.
*
* @package Drupal\custom_forms
*/
class AESEncryption {
/**
* @var \phpseclib\Crypt\AES $AES
* The AES encryption instance.
*/
protected $AES;
/**
* AESEncryption constructor.
*
* @param string $key
*/
public function __construct($key) {
$this->AES = new AES();
$this->AES->setKey($key);
}
public function encrypt($string) {
return $this->AES->encrypt($string);
}
public function decrypt($string) {
return $this->AES->decrypt($string);
}
}