Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
novicell/custom_forms / src / AESEncryption.php
Size: Mime:
<?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);
  }
}