* Added new (PHP7+) CSRNGProvider (uses random_bytes)

* Added a bunch basic of unittests for the RNG's
* QRicketProvider and QRServerProvider now throw on invalid MIME-types
* TwoFactorAuth now first tries to use CSRNGProvider before any of the other RNG providers
This commit is contained in:
RobThree
2015-12-02 16:38:20 +01:00
parent 856167c950
commit c94fcd83d8
7 changed files with 83 additions and 9 deletions
+3 -1
View File
@@ -45,7 +45,9 @@ class TwoFactorAuth
// Try to find best available RNG provider if none was specified
if ($rngprovider==null) {
if (function_exists('mcrypt_create_iv')) {
if (function_exists('random_bytes')) {
$rngprovider = new Providers\Rng\CSRNGProvider();
} elseif (function_exists('mcrypt_create_iv')) {
$rngprovider = new Providers\Rng\MCryptRNGProvider();
} elseif (function_exists('openssl_random_pseudo_bytes')) {
$rngprovider = new Providers\Rng\OpenSSLRNGProvider();