Skip to content

Commit 0cfa53a

Browse files
committed
ENGCOM-2841: Fix external Sodium Encryption PR
1 parent d6c3152 commit 0cfa53a

File tree

5 files changed

+22
-10
lines changed

5 files changed

+22
-10
lines changed

dev/tests/integration/testsuite/Magento/EncryptionKey/Setup/Patch/Data/SodiumChachaPatchTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function testChangeEncryptionKey()
8181

8282
private function legacyEncrypt(string $data): string
8383
{
84-
// @codingStandardIgnoreStart
84+
// @codingStandardsIgnoreStart
8585
$handle = @mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_CBC, '');
8686
$initVectorSize = @mcrypt_enc_get_iv_size($handle);
8787
$initVector = str_repeat("\0", $initVectorSize);
@@ -91,7 +91,7 @@ private function legacyEncrypt(string $data): string
9191

9292
@mcrypt_generic_deinit($handle);
9393
@mcrypt_module_close($handle);
94-
// @codingStandardIgnoreEnd
94+
// @codingStandardsIgnoreEnd
9595

9696
return '0:' . Encryptor::CIPHER_RIJNDAEL_256 . ':' . base64_encode($encrpted);
9797
}

dev/tests/integration/testsuite/Magento/Sales/_files/payment_enc_cc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* Creates an encrypted card number with the current crypt key using
2323
* a legacy cipher.
2424
*/
25-
// @codingStandardIgnoreStart
25+
// @codingStandardsIgnoreStart
2626
$handle = @mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_CBC, '');
2727
$initVectorSize = @mcrypt_enc_get_iv_size($handle);
2828
$initVector = str_repeat("\0", $initVectorSize);
@@ -32,7 +32,7 @@
3232

3333
@mcrypt_generic_deinit($handle);
3434
@mcrypt_module_close($handle);
35-
// @codingStandardIgnoreEnd
35+
// @codingStandardsIgnoreEnd
3636

3737
/** @var SearchCriteria $searchCriteria */
3838
$searchCriteria = $objectManager->get(SearchCriteriaBuilder::class)

lib/internal/Magento/Framework/Encryption/Adapter/EncryptionAdapterInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
26

37
declare(strict_types=1);
48

lib/internal/Magento/Framework/Encryption/Adapter/Mcrypt.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
26

37
declare(strict_types=1);
48

@@ -47,17 +51,17 @@ public function __construct(
4751
) {
4852
$this->cipher = $cipher;
4953
$this->mode = $mode;
50-
// @codingStandardIgnoreLine
54+
// @codingStandardsIgnoreLine
5155
$this->handle = @mcrypt_module_open($cipher, '', $mode, '');
5256
try {
53-
// @codingStandardIgnoreLine
57+
// @codingStandardsIgnoreLine
5458
$maxKeySize = @mcrypt_enc_get_key_size($this->handle);
5559
if (strlen($key) > $maxKeySize) {
5660
throw new \Magento\Framework\Exception\LocalizedException(
5761
new \Magento\Framework\Phrase('Key must not exceed %1 bytes.', [$maxKeySize])
5862
);
5963
}
60-
// @codingStandardIgnoreLine
64+
// @codingStandardsIgnoreLine
6165
$initVectorSize = @mcrypt_enc_get_iv_size($this->handle);
6266
if (null === $initVector) {
6367
/* Set vector to zero bytes to not use it */
@@ -72,11 +76,11 @@ public function __construct(
7276
}
7377
$this->initVector = $initVector;
7478
} catch (\Exception $e) {
75-
// @codingStandardIgnoreLine
79+
// @codingStandardsIgnoreLine
7680
@mcrypt_module_close($this->handle);
7781
throw new \Magento\Framework\Exception\LocalizedException(new \Magento\Framework\Phrase($e->getMessage()));
7882
}
79-
// @codingStandardIgnoreLine
83+
// @codingStandardsIgnoreLine
8084
@mcrypt_generic_init($this->handle, $key, $initVector);
8185
}
8286

@@ -156,7 +160,7 @@ public function decrypt(string $data): string
156160
if (strlen($data) == 0) {
157161
return $data;
158162
}
159-
// @codingStandardIgnoreLine
163+
// @codingStandardsIgnoreLine
160164
$data = @mdecrypt_generic($this->handle, $data);
161165
/*
162166
* Returned string can in fact be longer than the unencrypted string due to the padding of the data

lib/internal/Magento/Framework/Encryption/Adapter/SodiumChachaIetf.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
26

37
declare(strict_types=1);
48

0 commit comments

Comments
 (0)