Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2016-01-05 19:08:57 +0300
committerLukas Reschke <lukas@owncloud.com>2016-02-10 01:43:26 +0300
commitb9ff16498befe211205ea3c20c2eb341f97919fa (patch)
treead96d4e0d5f80f4cf81ae44b5862e5151b22113a /apps/encryption
parent61dd191253fb3bead23143a503c9d25780f2e63d (diff)
Use random_bytes instead OpenSSL
Diffstat (limited to 'apps/encryption')
-rw-r--r--apps/encryption/lib/crypto/crypt.php9
1 files changed, 1 insertions, 8 deletions
diff --git a/apps/encryption/lib/crypto/crypt.php b/apps/encryption/lib/crypto/crypt.php
index e071819b163..d5a41c29009 100644
--- a/apps/encryption/lib/crypto/crypt.php
+++ b/apps/encryption/lib/crypto/crypt.php
@@ -614,14 +614,7 @@ class Crypt {
* @throws \Exception
*/
public function generateFileKey() {
- // Generate key
- $key = base64_encode(openssl_random_pseudo_bytes(32, $strong));
- if (!$key || !$strong) {
- // If OpenSSL indicates randomness is insecure, log error
- throw new \Exception('Encryption library, Insecure symmetric key was generated using openssl_random_pseudo_bytes()');
- }
-
- return $key;
+ return base64_encode(random_bytes(32));
}
/**