summaryrefslogtreecommitdiffstats
path: root/Core/Util
diff options
context:
space:
mode:
authorFabien Potencier <fabien.potencier@gmail.com>2012-10-27 10:45:19 +0200
committerFabien Potencier <fabien.potencier@gmail.com>2012-10-28 08:06:38 +0100
commit01ac68a3cee68d8ab99d0da264e7ca332b7e3df9 (patch)
treecfaff00496db3063e6918d457e12315fdd98034b /Core/Util
parent1fd9900caddeb88e2882e7572c5345bdf6769ba5 (diff)
downloadsymfony-security-01ac68a3cee68d8ab99d0da264e7ca332b7e3df9.zip
symfony-security-01ac68a3cee68d8ab99d0da264e7ca332b7e3df9.tar.gz
symfony-security-01ac68a3cee68d8ab99d0da264e7ca332b7e3df9.tar.bz2
added a SecureRandomInterface
Diffstat (limited to 'Core/Util')
-rw-r--r--Core/Util/SecureRandom.php7
-rw-r--r--Core/Util/SecureRandomInterface.php31
2 files changed, 33 insertions, 5 deletions
diff --git a/Core/Util/SecureRandom.php b/Core/Util/SecureRandom.php
index 14a1f3d..77f1d8c 100644
--- a/Core/Util/SecureRandom.php
+++ b/Core/Util/SecureRandom.php
@@ -19,7 +19,7 @@ use Symfony\Component\HttpKernel\Log\LoggerInterface;
* @author Fabien Potencier <fabien@symfony.com>
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
-final class SecureRandom
+final class SecureRandom implements SecureRandomInterface
{
private $logger;
private $useOpenSsl;
@@ -56,10 +56,7 @@ final class SecureRandom
}
/**
- * Generates the specified number of secure random bytes.
- *
- * @param integer $nbBytes
- * @return string
+ * {@inheritdoc}
*/
public function nextBytes($nbBytes)
{
diff --git a/Core/Util/SecureRandomInterface.php b/Core/Util/SecureRandomInterface.php
new file mode 100644
index 0000000..f2d8175
--- /dev/null
+++ b/Core/Util/SecureRandomInterface.php
@@ -0,0 +1,31 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Security\Core\Util;
+
+use Symfony\Component\HttpKernel\Log\LoggerInterface;
+
+/**
+ * A secure random number generator implementation.
+ *
+ * @author Fabien Potencier <fabien@symfony.com>
+ */
+interface SecureRandomInterface
+{
+ /**
+ * Generates the specified number of secure random bytes.
+ *
+ * @param integer $nbBytes
+ *
+ * @return string
+ */
+ public function nextBytes($nbBytes);
+}