public function testEncryption() { $availableCiphers = PSL\Encrypter::getSupportedCiphers(); $availableModes = PSL\Encrypter::getSupportedModes(); $e = new PSL\Encrypter(); $key = 'a test key'; $plainText = 'some plain text'; foreach ($availableCiphers as $cipher) { foreach ($availableModes as $mode) { $cipherText = $e->encrypt($cipher, $key, $plainText, $mode); if ($cipherText != false) { $plainTextDeciphered = $e->decrypt($cipherText, $key); $this->assertTrue($plainText === $plainTextDeciphered, "Deciphered text did not match ({$cipher}, {$mode})!"); } } } }
Yii::app()->rbac->assignRole($user->id, 'authenticated'); } } exit; define('PSL_RANDOM_GENERATOR', 'capicom'); var_dump(PSL\Randomizer::getRandomBytes(1), PSL\Randomizer::$generatorUsed); exit; $availableCiphers = PSL\Encrypter::getSupportedCiphers(); $availableModes = PSL\Encrypter::getSupportedModes(); $enc = new PSL\Encrypter(); $key = 'asdfgha test key'; $plainText = 'some plain text'; foreach ($availableCiphers as $cipher) { foreach ($availableModes as $mode) { try { $cipherText = $enc->encrypt($cipher, $plainText, $key, $mode); if ($cipherText != false) { $plainTextDeciphered = $enc->decrypt($cipherText, $key); } } catch (Exception $e) { echo "<br />" . $e->getMessage() . "<br />"; } echo "{$cipher} ({$mode}): {$cipherText}<br />"; flush(); } } exit; /* header('content-type: text/plain'); $userInput = 'ab\\a'; // The user tries to traverse //Security_Executor::shell('RENAME', 'C:\\' . $userInput, 'target');// and succeeds lol