diff --git a/apps/files_sharing/tests/controller/sharecontroller.php b/apps/files_sharing/tests/controller/sharecontroller.php index 398538f094..87b9e2839d 100644 --- a/apps/files_sharing/tests/controller/sharecontroller.php +++ b/apps/files_sharing/tests/controller/sharecontroller.php @@ -76,7 +76,7 @@ class ShareControllerTest extends \Test\TestCase { $this->oldUser = \OC_User::getUser(); // Create a dummy user - $this->user = \OC::$server->getSecureRandom()->getLowStrengthGenerator()->generate(12, ISecureRandom::CHAR_LOWER); + $this->user = \OC::$server->getSecureRandom()->generate(12, ISecureRandom::CHAR_LOWER); \OC::$server->getUserManager()->createUser($this->user, $this->user); \OC_Util::tearDownFS(); diff --git a/lib/private/appframework/http/request.php b/lib/private/appframework/http/request.php index 6ba1d8f644..94e58cfc67 100644 --- a/lib/private/appframework/http/request.php +++ b/lib/private/appframework/http/request.php @@ -465,7 +465,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { } if(empty($this->requestId)) { - $this->requestId = $this->secureRandom->getLowStrengthGenerator()->generate(20); + $this->requestId = $this->secureRandom->generate(20); } return $this->requestId; diff --git a/lib/private/cache/file.php b/lib/private/cache/file.php index 31d4718d18..c531f8c610 100644 --- a/lib/private/cache/file.php +++ b/lib/private/cache/file.php @@ -99,7 +99,7 @@ class File implements ICache { $storage = $this->getStorage(); $result = false; // unique id to avoid chunk collision, just in case - $uniqueId = \OC::$server->getSecureRandom()->getLowStrengthGenerator()->generate( + $uniqueId = \OC::$server->getSecureRandom()->generate( 16, ISecureRandom::CHAR_DIGITS . ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER ); diff --git a/lib/private/security/crypto.php b/lib/private/security/crypto.php index 46d0c750b2..6737902640 100644 --- a/lib/private/security/crypto.php +++ b/lib/private/security/crypto.php @@ -90,7 +90,7 @@ class Crypto implements ICrypto { } $this->cipher->setPassword($password); - $iv = $this->random->getLowStrengthGenerator()->generate($this->ivLength); + $iv = $this->random->generate($this->ivLength); $this->cipher->setIV($iv); $ciphertext = bin2hex($this->cipher->encrypt($plaintext)); diff --git a/lib/private/setup.php b/lib/private/setup.php index 770f5cdab5..d318e5f057 100644 --- a/lib/private/setup.php +++ b/lib/private/setup.php @@ -310,9 +310,9 @@ class Setup { } //generate a random salt that is used to salt the local user passwords - $salt = $this->random->getLowStrengthGenerator()->generate(30); + $salt = $this->random->generate(30); // generate a secret - $secret = $this->random->getMediumStrengthGenerator()->generate(48); + $secret = $this->random->generate(48); //write the config file $this->config->setSystemValues([ diff --git a/lib/private/util.php b/lib/private/util.php index 4bcde68c35..5a7a4d8ae5 100644 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -1097,7 +1097,7 @@ class OC_Util { $id = \OC::$server->getSystemConfig()->getValue('instanceid', null); if (is_null($id)) { // We need to guarantee at least one letter in instanceid so it can be used as the session_name - $id = 'oc' . \OC::$server->getSecureRandom()->getLowStrengthGenerator()->generate(10, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS); + $id = 'oc' . \OC::$server->getSecureRandom()->generate(10, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS); \OC::$server->getSystemConfig()->setValue('instanceid', $id); } return $id; diff --git a/tests/lib/security/securerandom.php b/tests/lib/security/securerandom.php index af43764080..5eede9a30f 100644 --- a/tests/lib/security/securerandom.php +++ b/tests/lib/security/securerandom.php @@ -42,7 +42,7 @@ class SecureRandomTest extends \Test\TestCase { * @dataProvider stringGenerationProvider */ function testGetLowStrengthGeneratorLength($length, $expectedLength) { - $generator = $this->rng->getLowStrengthGenerator(); + $generator = $this->rng; $this->assertEquals($expectedLength, strlen($generator->generate($length))); } diff --git a/tests/lib/testcase.php b/tests/lib/testcase.php index 93b354863a..38d5cf4932 100644 --- a/tests/lib/testcase.php +++ b/tests/lib/testcase.php @@ -150,7 +150,7 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase { * @return string */ protected static function getUniqueID($prefix = '', $length = 13) { - return $prefix . \OC::$server->getSecureRandom()->getLowStrengthGenerator()->generate( + return $prefix . \OC::$server->getSecureRandom()->generate( $length, // Do not use dots and slashes as we use the value for file names ISecureRandom::CHAR_DIGITS . ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER