Use random_bytes instead OpenSSL

This commit is contained in:
Lukas Reschke 2016-01-05 17:08:57 +01:00
parent 61dd191253
commit b9ff16498b
1 changed files with 1 additions and 8 deletions

View File

@ -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));
}
/**