Skip to content

Commit 93949eb

Browse files
committed
MAGETWO-89395: Encryption support
- Remove commented code
1 parent 512ea21 commit 93949eb

File tree

1 file changed

+2
-38
lines changed

1 file changed

+2
-38
lines changed

lib/internal/Magento/Framework/Encryption/Test/Unit/CryptTest.php

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,7 @@ protected function _getRandomString($length)
3838
protected function _requireCipherInfo()
3939
{
4040
$filename = __DIR__ . '/Crypt/_files/_cipher_info.php';
41-
/* Generate allowed sizes for encryption key and init vector
42-
$data = array();
43-
foreach ($this->_supportedCiphers as $cipher) {
44-
if (!array_key_exists($cipher, $data)) {
45-
$data[$cipher] = array();
46-
}
47-
foreach ($this->_supportedModes as $mode) {
48-
$cipherHandle = mcrypt_module_open($cipher, '', $mode, '');
49-
$data[$cipher][$mode] = array(
50-
'key_size' => mcrypt_enc_get_key_size($cipherHandle),
51-
'iv_size' => mcrypt_enc_get_iv_size($cipherHandle),
52-
);
53-
mcrypt_module_close($cipherHandle);
54-
}
55-
}
56-
file_put_contents($filename, '<?php return ' . var_export($data, true) . ";\n", LOCK_EX);
57-
*/
41+
5842
if (!self::$_cipherInfo) {
5943
self::$_cipherInfo = include $filename;
6044
}
@@ -138,27 +122,7 @@ public function testConstructorDefaults()
138122
public function getCryptData()
139123
{
140124
$fixturesFilename = __DIR__ . '/Crypt/_files/_crypt_fixtures.php';
141-
/* Generate fixtures
142-
$fixtures = array();
143-
foreach (array('', 'Hello world!!!') as $inputString) {
144-
foreach ($this->_supportedCiphers as $cipher) {
145-
foreach ($this->_supportedModes as $mode) {
146-
$randomKey = $this->_getRandomString($this->_getKeySize($cipher, $mode));
147-
$randomInitVector = $this->_getRandomString($this->_getInitVectorSize($cipher, $mode));
148-
$crypt = new \Magento\Framework\Encryption\Crypt($randomKey, $cipher, $mode, $randomInitVector);
149-
$fixtures[] = array(
150-
$randomKey, // Encryption key
151-
$cipher,
152-
$mode,
153-
$randomInitVector, // Init vector
154-
$inputString, // String to encrypt
155-
base64_encode($crypt->encrypt($inputString)) // Store result of encryption as base64
156-
);
157-
}
158-
}
159-
}
160-
file_put_contents($fixturesFilename, '<?php return ' . var_export($fixtures, true) . ";\n", LOCK_EX);
161-
*/
125+
162126
$result = include $fixturesFilename;
163127
/* Restore encoded string back to binary */
164128
foreach ($result as &$cryptParams) {

0 commit comments

Comments
 (0)