mcrypt = new \Magento\Framework\Encryption\Adapter\Mcrypt( $key, $cipher, $mode, $initVector === false ? null : $initVector ); } /** * Retrieve a name of currently used cryptographic algorithm * * @return string */ public function getCipher() { return $this->mcrypt->getCipher(); } /** * Mode in which cryptographic algorithm is running * * @return string */ public function getMode() { return $this->mcrypt->getMode(); } /** * Retrieve an actual value of initial vector that has been used to initialize a cipher * * @return string */ public function getInitVector() { return $this->mcrypt->getInitVector(); } /** * Encrypt a data * * @param string $data String to encrypt * @return string */ public function encrypt($data) { if (strlen($data) == 0) { return $data; } // @codingStandardsIgnoreLine return @mcrypt_generic($this->mcrypt->getHandle(), $data); } /** * Decrypt a data * * @param string $data String to decrypt * @return string */ public function decrypt($data) { return $this->mcrypt->decrypt($data); } }