Browse Source

getLowStrengthGenerator does not do anything anymore

tags/v9.0beta1
Roeland Jago Douma 8 years ago
parent
commit
98c4951f45

+ 1
- 1
apps/files_sharing/tests/controller/sharecontroller.php View File

@@ -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();

+ 1
- 1
lib/private/appframework/http/request.php View File

@@ -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;

+ 1
- 1
lib/private/cache/file.php View File

@@ -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
);

+ 1
- 1
lib/private/security/crypto.php View File

@@ -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));

+ 2
- 2
lib/private/setup.php View File

@@ -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([

+ 1
- 1
lib/private/util.php View File

@@ -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;

+ 1
- 1
tests/lib/security/securerandom.php View File

@@ -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)));
}

+ 1
- 1
tests/lib/testcase.php View File

@@ -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

Loading…
Cancel
Save