aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-01-12 09:12:13 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-01-12 09:12:13 +0100
commit3ec8789c7708aea2f8b4335af7d496a957a16011 (patch)
tree669088ff58bb1f727f769e3456af1f4c96bc4fd4 /apps
parentd11d9407cea94ebe430e50b81e01a671ec60f642 (diff)
parent07fd3889b1e7752131dc0bc746abec7646c89d01 (diff)
downloadnextcloud-server-3ec8789c7708aea2f8b4335af7d496a957a16011.tar.gz
nextcloud-server-3ec8789c7708aea2f8b4335af7d496a957a16011.zip
Merge pull request #21628 from owncloud/deprecated_secure_random_funcions
Replace deprecated function calls to SecureRandom
Diffstat (limited to 'apps')
-rw-r--r--apps/encryption/lib/crypto/encryptall.php2
-rw-r--r--apps/federation/api/ocsauthapi.php2
-rw-r--r--apps/federation/lib/trustedservers.php2
-rw-r--r--apps/federation/tests/api/ocsauthapitest.php2
-rw-r--r--apps/federation/tests/lib/trustedserverstest.php2
-rw-r--r--apps/files_sharing/tests/controller/sharecontroller.php2
6 files changed, 4 insertions, 8 deletions
diff --git a/apps/encryption/lib/crypto/encryptall.php b/apps/encryption/lib/crypto/encryptall.php
index ef67523d7e2..3bc2746f5fa 100644
--- a/apps/encryption/lib/crypto/encryptall.php
+++ b/apps/encryption/lib/crypto/encryptall.php
@@ -344,7 +344,7 @@ class EncryptAll {
* @return string password
*/
protected function generateOneTimePassword($uid) {
- $password = $this->secureRandom->getMediumStrengthGenerator()->generate(8);
+ $password = $this->secureRandom->generate(8);
$this->userPasswords[$uid] = $password;
return $password;
}
diff --git a/apps/federation/api/ocsauthapi.php b/apps/federation/api/ocsauthapi.php
index b94550fd4f2..c089c89f9d4 100644
--- a/apps/federation/api/ocsauthapi.php
+++ b/apps/federation/api/ocsauthapi.php
@@ -139,7 +139,7 @@ class OCSAuthAPI {
return new \OC_OCS_Result(null, HTTP::STATUS_FORBIDDEN);
}
- $sharedSecret = $this->secureRandom->getMediumStrengthGenerator()->generate(32);
+ $sharedSecret = $this->secureRandom->generate(32);
$this->trustedServers->addSharedSecret($url, $sharedSecret);
// reset token after the exchange of the shared secret was successful
diff --git a/apps/federation/lib/trustedservers.php b/apps/federation/lib/trustedservers.php
index 96a29178076..d1a27bf1220 100644
--- a/apps/federation/lib/trustedservers.php
+++ b/apps/federation/lib/trustedservers.php
@@ -90,7 +90,7 @@ class TrustedServers {
$url = $this->updateProtocol($url);
$result = $this->dbHandler->addServer($url);
if ($result) {
- $token = $this->secureRandom->getMediumStrengthGenerator()->generate(16);
+ $token = $this->secureRandom->generate(16);
$this->dbHandler->addToken($url, $token);
$this->jobList->add(
'OCA\Federation\BackgroundJob\RequestSharedSecret',
diff --git a/apps/federation/tests/api/ocsauthapitest.php b/apps/federation/tests/api/ocsauthapitest.php
index e6a95af8585..0a708a0a9f2 100644
--- a/apps/federation/tests/api/ocsauthapitest.php
+++ b/apps/federation/tests/api/ocsauthapitest.php
@@ -155,8 +155,6 @@ class OCSAuthAPITest extends TestCase {
->method('isValidToken')->with($url, $token)->willReturn($isValidToken);
if($expected === Http::STATUS_OK) {
- $this->secureRandom->expects($this->once())->method('getMediumStrengthGenerator')
- ->willReturn($this->secureRandom);
$this->secureRandom->expects($this->once())->method('generate')->with(32)
->willReturn('secret');
$this->trustedServers->expects($this->once())
diff --git a/apps/federation/tests/lib/trustedserverstest.php b/apps/federation/tests/lib/trustedserverstest.php
index d067cd1c185..c1b3f83d69f 100644
--- a/apps/federation/tests/lib/trustedserverstest.php
+++ b/apps/federation/tests/lib/trustedserverstest.php
@@ -113,8 +113,6 @@ class TrustedServersTest extends TestCase {
->willReturn($success);
if ($success) {
- $this->secureRandom->expects($this->once())->method('getMediumStrengthGenerator')
- ->willReturn($this->secureRandom);
$this->secureRandom->expects($this->once())->method('generate')
->willReturn('token');
$this->dbHandler->expects($this->once())->method('addToken')->with('https://url', 'token');
diff --git a/apps/files_sharing/tests/controller/sharecontroller.php b/apps/files_sharing/tests/controller/sharecontroller.php
index 398538f0943..87b9e2839d7 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();