getLowStrengthGenerator does not do anything anymore
This commit is contained in:
parent
373776b8d8
commit
98c4951f45
|
@ -76,7 +76,7 @@ class ShareControllerTest extends \Test\TestCase {
|
||||||
$this->oldUser = \OC_User::getUser();
|
$this->oldUser = \OC_User::getUser();
|
||||||
|
|
||||||
// Create a dummy user
|
// 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::$server->getUserManager()->createUser($this->user, $this->user);
|
||||||
\OC_Util::tearDownFS();
|
\OC_Util::tearDownFS();
|
||||||
|
|
|
@ -465,7 +465,7 @@ class Request implements \ArrayAccess, \Countable, IRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(empty($this->requestId)) {
|
if(empty($this->requestId)) {
|
||||||
$this->requestId = $this->secureRandom->getLowStrengthGenerator()->generate(20);
|
$this->requestId = $this->secureRandom->generate(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->requestId;
|
return $this->requestId;
|
||||||
|
|
|
@ -99,7 +99,7 @@ class File implements ICache {
|
||||||
$storage = $this->getStorage();
|
$storage = $this->getStorage();
|
||||||
$result = false;
|
$result = false;
|
||||||
// unique id to avoid chunk collision, just in case
|
// unique id to avoid chunk collision, just in case
|
||||||
$uniqueId = \OC::$server->getSecureRandom()->getLowStrengthGenerator()->generate(
|
$uniqueId = \OC::$server->getSecureRandom()->generate(
|
||||||
16,
|
16,
|
||||||
ISecureRandom::CHAR_DIGITS . ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER
|
ISecureRandom::CHAR_DIGITS . ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER
|
||||||
);
|
);
|
||||||
|
|
|
@ -90,7 +90,7 @@ class Crypto implements ICrypto {
|
||||||
}
|
}
|
||||||
$this->cipher->setPassword($password);
|
$this->cipher->setPassword($password);
|
||||||
|
|
||||||
$iv = $this->random->getLowStrengthGenerator()->generate($this->ivLength);
|
$iv = $this->random->generate($this->ivLength);
|
||||||
$this->cipher->setIV($iv);
|
$this->cipher->setIV($iv);
|
||||||
|
|
||||||
$ciphertext = bin2hex($this->cipher->encrypt($plaintext));
|
$ciphertext = bin2hex($this->cipher->encrypt($plaintext));
|
||||||
|
|
|
@ -310,9 +310,9 @@ class Setup {
|
||||||
}
|
}
|
||||||
|
|
||||||
//generate a random salt that is used to salt the local user passwords
|
//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
|
// generate a secret
|
||||||
$secret = $this->random->getMediumStrengthGenerator()->generate(48);
|
$secret = $this->random->generate(48);
|
||||||
|
|
||||||
//write the config file
|
//write the config file
|
||||||
$this->config->setSystemValues([
|
$this->config->setSystemValues([
|
||||||
|
|
|
@ -1097,7 +1097,7 @@ class OC_Util {
|
||||||
$id = \OC::$server->getSystemConfig()->getValue('instanceid', null);
|
$id = \OC::$server->getSystemConfig()->getValue('instanceid', null);
|
||||||
if (is_null($id)) {
|
if (is_null($id)) {
|
||||||
// We need to guarantee at least one letter in instanceid so it can be used as the session_name
|
// 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);
|
\OC::$server->getSystemConfig()->setValue('instanceid', $id);
|
||||||
}
|
}
|
||||||
return $id;
|
return $id;
|
||||||
|
|
|
@ -42,7 +42,7 @@ class SecureRandomTest extends \Test\TestCase {
|
||||||
* @dataProvider stringGenerationProvider
|
* @dataProvider stringGenerationProvider
|
||||||
*/
|
*/
|
||||||
function testGetLowStrengthGeneratorLength($length, $expectedLength) {
|
function testGetLowStrengthGeneratorLength($length, $expectedLength) {
|
||||||
$generator = $this->rng->getLowStrengthGenerator();
|
$generator = $this->rng;
|
||||||
|
|
||||||
$this->assertEquals($expectedLength, strlen($generator->generate($length)));
|
$this->assertEquals($expectedLength, strlen($generator->generate($length)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,7 +150,7 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected static function getUniqueID($prefix = '', $length = 13) {
|
protected static function getUniqueID($prefix = '', $length = 13) {
|
||||||
return $prefix . \OC::$server->getSecureRandom()->getLowStrengthGenerator()->generate(
|
return $prefix . \OC::$server->getSecureRandom()->generate(
|
||||||
$length,
|
$length,
|
||||||
// Do not use dots and slashes as we use the value for file names
|
// Do not use dots and slashes as we use the value for file names
|
||||||
ISecureRandom::CHAR_DIGITS . ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER
|
ISecureRandom::CHAR_DIGITS . ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER
|
||||||
|
|
Loading…
Reference in New Issue