use libsodium to run Argon2i related tests

This commit is contained in:
Christian Flothmann 2018-02-05 16:46:42 +01:00
parent ae25291610
commit 5f9471ef47
3 changed files with 11 additions and 3 deletions

View File

@ -149,7 +149,15 @@ before_install:
([[ $deps ]] || tfold ext.symfony_debug 'cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> '"$INI")
tfold ext.apcu tpecl apcu-4.0.11 apcu.so
elif [[ ! $skip && $PHP = 7.* ]]; then
# install libsodium
if [[ ! -e ~/php-ext/$(php -r "echo basename(ini_get('extension_dir'));")/libsodium/sodium.so ]]; then
sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get update -q
sudo apt-get install libsodium-dev -y
fi
tfold ext.apcu tpecl apcu-5.1.6 apcu.so
tfold ext.libsodium tpecl libsodium sodium.so
tfold ext.mongodb tpecl mongodb-1.4.0RC1 mongodb.so
fi

View File

@ -1,6 +1,6 @@
security:
encoders:
JMS\FooBundle\Entity\User6:
JMS\FooBundle\Entity\User7:
algorithm: argon2i
providers:

View File

@ -86,7 +86,7 @@ class UserPasswordEncoderCommandTest extends WebTestCase
$this->assertContains('Password encoding succeeded', $output);
$encoder = new Argon2iPasswordEncoder();
preg_match('# Encoded password\s+(\$argon2i\$[\w\d,=\$+\/]+={0,2})\s+#', $output, $matches);
preg_match('# Encoded password\s+(\$argon2id\$[\w\d,=\$+\/]+={0,2})\s+#', $output, $matches);
$hash = $matches[1];
$this->assertTrue($encoder->isPasswordValid($hash, 'password', null));
}
@ -272,7 +272,7 @@ EOTXT
private function setupArgon2i()
{
putenv('COLUMNS='.(119 + strlen(PHP_EOL)));
$kernel = $this->createKernel(array('test_case' => 'PasswordEncode', 'root_config' => 'argon2i'));
$kernel = $this->createKernel(array('test_case' => 'PasswordEncode', 'root_config' => 'argon2i.yml'));
$kernel->boot();
$application = new Application($kernel);