diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-01-11 09:55:35 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-01-11 09:55:35 +0100 |
commit | 171b279753d704bfa1c5fe2591963612289a54b1 (patch) | |
tree | 9368888432903b5eacdaf6abd6d311fcecbec586 /lib | |
parent | 77a8085f8470164c22af8c1533cee94876c9544d (diff) | |
parent | e01a488b3136ec7b0f2614cd49e4cf1afce1f655 (diff) | |
download | nextcloud-server-171b279753d704bfa1c5fe2591963612289a54b1.tar.gz nextcloud-server-171b279753d704bfa1c5fe2591963612289a54b1.zip |
Merge pull request #21594 from owncloud/cleanup_util
Remove generateRandomBytes from OC_Util
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/setup/oci.php | 2 | ||||
-rw-r--r-- | lib/private/setup/postgresql.php | 2 | ||||
-rw-r--r-- | lib/private/util.php | 12 | ||||
-rw-r--r-- | lib/public/util.php | 2 |
4 files changed, 3 insertions, 15 deletions
diff --git a/lib/private/setup/oci.php b/lib/private/setup/oci.php index e5634572d90..d335df850cf 100644 --- a/lib/private/setup/oci.php +++ b/lib/private/setup/oci.php @@ -106,7 +106,7 @@ class OCI extends AbstractDatabase { //add prefix to the oracle user name to prevent collisions $this->dbUser='oc_'.$username; //create a new password so we don't need to store the admin config in the config file - $this->dbPassword=\OC_Util::generateRandomBytes(30); + $this->dbPassword = \OC::$server->getSecureRandom()->generate(30, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS); //oracle passwords are treated as identifiers: // must start with alphanumeric char diff --git a/lib/private/setup/postgresql.php b/lib/private/setup/postgresql.php index 59762209d08..850551e794f 100644 --- a/lib/private/setup/postgresql.php +++ b/lib/private/setup/postgresql.php @@ -61,7 +61,7 @@ class PostgreSQL extends AbstractDatabase { //add prefix to the postgresql user name to prevent collisions $this->dbUser='oc_'.$username; //create a new password so we don't need to store the admin config in the config file - $this->dbPassword=\OC_Util::generateRandomBytes(30); + $this->dbPassword = \OC::$server->getSecureRandom()->generate(30, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS); $this->createDBUser($connection); } diff --git a/lib/private/util.php b/lib/private/util.php index ecb18946f12..ed62f1afb4a 100644 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -1278,18 +1278,6 @@ class OC_Util { } } - - /** - * Generates a cryptographic secure pseudo-random string - * - * @param int $length of the random string - * @return string - * @deprecated Use \OC::$server->getSecureRandom()->getMediumStrengthGenerator()->generate($length); instead - */ - public static function generateRandomBytes($length = 30) { - return \OC::$server->getSecureRandom()->getMediumStrengthGenerator()->generate($length, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS); - } - /** * Checks whether the server is running on Windows * diff --git a/lib/public/util.php b/lib/public/util.php index 493aa0000a5..55bbd01eeaf 100644 --- a/lib/public/util.php +++ b/lib/public/util.php @@ -637,7 +637,7 @@ class Util { * @since 7.0.0 */ public static function generateRandomBytes($length = 30) { - return \OC_Util::generateRandomBytes($length); + return \OC::$server->getSecureRandom()->generate($length, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS); } /** |