summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2016-01-05 17:08:57 +0100
committerLukas Reschke <lukas@owncloud.com>2016-02-09 23:43:26 +0100
commitb9ff16498befe211205ea3c20c2eb341f97919fa (patch)
treead96d4e0d5f80f4cf81ae44b5862e5151b22113a
parent61dd191253fb3bead23143a503c9d25780f2e63d (diff)
downloadnextcloud-server-b9ff16498befe211205ea3c20c2eb341f97919fa.tar.gz
nextcloud-server-b9ff16498befe211205ea3c20c2eb341f97919fa.zip
Use random_bytes instead OpenSSL
-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));
}
/**