7 declare(strict_types=1);
18 $fixturesFilename =
__DIR__ .
'/../Crypt/_files/_sodium_chachaieft_fixtures.php';
20 $result = include $fixturesFilename;
22 foreach (
$result as &$cryptParams) {
23 $cryptParams[
'encrypted'] = base64_decode($cryptParams[
'encrypted']);
33 public function testEncrypt(
string $key,
string $encrypted,
string $decrypted)
35 $crypt = new \Magento\Framework\Encryption\Adapter\SodiumChachaIetf($key);
36 $result = $crypt->encrypt($decrypted);
38 $this->assertNotEquals($encrypted,
$result);
44 public function testDecrypt(
string $key,
string $encrypted,
string $decrypted)
46 $crypt = new \Magento\Framework\Encryption\Adapter\SodiumChachaIetf($key);
47 $result = $crypt->decrypt($encrypted);
49 $this->assertEquals($decrypted,
$result);
testDecrypt(string $key, string $encrypted, string $decrypted)
defined('TESTS_BP')||define('TESTS_BP' __DIR__
testEncrypt(string $key, string $encrypted, string $decrypted)