Class encapsulates cryptographic algorithm
@api
- Deprecated:
- Since
- 100.0.2
Definition at line 18 of file Crypt.php.
◆ __construct()
__construct |
( |
|
$key, |
|
|
|
$cipher = MCRYPT_BLOWFISH , |
|
|
|
$mode = MCRYPT_MODE_ECB , |
|
|
|
$initVector = false |
|
) |
| |
Constructor
- Parameters
-
string | $key | Secret encryption key. It's unsafe to store encryption key in memory, so no getter for key exists. |
string | $cipher | Cipher algorithm (one of the MCRYPT_ciphername constants) |
string | $mode | Mode of cipher algorithm (MCRYPT_MODE_modeabbr constants) |
string | bool | $initVector | Initial vector to fill algorithm blocks. TRUE generates a random initial vector. FALSE fills initial vector with zero bytes to not use it. |
- Exceptions
-
Definition at line 54 of file Crypt.php.
67 $allowedCharacters =
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
70 $initVector .= $allowedCharacters[rand(0, strlen($allowedCharacters) - 1)];
73 @mcrypt_generic_deinit(
$handle);
78 $this->mcrypt = new \Magento\Framework\Encryption\Adapter\Mcrypt(
if($exist=($block->getProductCollection() && $block->getProductCollection() ->getSize())) $mode
◆ decrypt()
Decrypt a data
- Parameters
-
string | $data | String to decrypt |
- Returns
- string
Definition at line 137 of file Crypt.php.
139 return $this->mcrypt->decrypt(
$data);
◆ encrypt()
Encrypt a data
- Parameters
-
string | $data | String to encrypt |
- Returns
- string
Definition at line 122 of file Crypt.php.
124 if (strlen(
$data) == 0) {
128 return @mcrypt_generic($this->mcrypt->getHandle(),
$data);
◆ getCipher()
Retrieve a name of currently used cryptographic algorithm
- Returns
- string
Definition at line 91 of file Crypt.php.
93 return $this->mcrypt->getCipher();
◆ getInitVector()
Retrieve an actual value of initial vector that has been used to initialize a cipher
- Returns
- string
Definition at line 111 of file Crypt.php.
113 return $this->mcrypt->getInitVector();
◆ getMode()
Mode in which cryptographic algorithm is running
- Returns
- string
Definition at line 101 of file Crypt.php.
103 return $this->mcrypt->getMode();
◆ $_cipher
◆ $_initVector
◆ $_mode
The documentation for this class was generated from the following file:
- vendor/magento/framework/Encryption/Crypt.php