summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Core/Util/SecureRandom.php8
-rw-r--r--composer.json4
2 files changed, 10 insertions, 2 deletions
diff --git a/Core/Util/SecureRandom.php b/Core/Util/SecureRandom.php
index f4167e4..65722ce 100644
--- a/Core/Util/SecureRandom.php
+++ b/Core/Util/SecureRandom.php
@@ -43,9 +43,9 @@ final class SecureRandom implements SecureRandomInterface
$this->logger = $logger;
// determine whether to use OpenSSL
- if (!function_exists('openssl_random_pseudo_bytes')) {
+ if (!function_exists('random_bytes') && !function_exists('openssl_random_pseudo_bytes')) {
if (null !== $this->logger) {
- $this->logger->notice('It is recommended that you enable the "openssl" extension for random number generation.');
+ $this->logger->notice('It is recommended that you install the "paragonie/random_compat" library or enable the "openssl" extension for random number generation.');
}
$this->useOpenSsl = false;
} else {
@@ -58,6 +58,10 @@ final class SecureRandom implements SecureRandomInterface
*/
public function nextBytes($nbBytes)
{
+ if (function_exists('random_bytes')) {
+ return random_bytes($nbBytes);
+ }
+
// try OpenSSL
if ($this->useOpenSsl) {
$bytes = openssl_random_pseudo_bytes($nbBytes, $strong);
diff --git a/composer.json b/composer.json
index 708c60f..cc3a319 100644
--- a/composer.json
+++ b/composer.json
@@ -41,10 +41,14 @@
"symfony/expression-language": "~2.6|~3.0.0"
},
"suggest": {
+ "symfony/class-loader": "For using the ACL generateSql script",
+ "symfony/finder": "For using the ACL generateSql script",
+ "symfony/form": "",
"symfony/validator": "For using the user password constraint",
"symfony/routing": "For using the HttpUtils class to create sub-requests, redirect the user, and match URLs",
"symfony/expression-language": "For using the expression voter",
"ircmaxell/password-compat": "For using the BCrypt password encoder in PHP <5.5"
+ "paragonie/random_compat": ""
},
"autoload": {
"psr-4": { "Symfony\\Component\\Security\\": "" }