mirror of
https://github.com/nextcloud/server.git
synced 2026-04-21 14:23:17 -04:00
Use random_bytes instead OpenSSL
This commit is contained in:
parent
61dd191253
commit
b9ff16498b
1 changed files with 1 additions and 8 deletions
|
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue