Skip to content

EspoCRM – Open Source CRM Application

remove no random_bytes fallback

Yuri Kuznetsovca5aa8edf040
diff --git a/application/Espo/Core/Authentication/AuthToken/EspoManager.php b/application/Espo/Core/Authentication/AuthToken/EspoManager.php
index b523dd81ca..5336cb7ab7 100644
--- a/application/Espo/Core/Authentication/AuthToken/EspoManager.php
+++ b/application/Espo/Core/Authentication/AuthToken/EspoManager.php
@@ -159,17 +159,6 @@ class EspoManager implements Manager
{
$length = self::TOKEN_RANDOM_LENGTH;
- if (function_exists('random_bytes')) {
- /** @noinspection PhpUnhandledExceptionInspection */
- return bin2hex(random_bytes($length));
- }
-
- if (function_exists('openssl_random_pseudo_bytes')) {
- $randomValue = openssl_random_pseudo_bytes($length);
-
- return bin2hex($randomValue);
- }
-
- throw new RuntimeException("Could not generate token.");
+ return bin2hex(random_bytes($length));
}
}
diff --git a/application/Espo/Core/Utils/Util.php b/application/Espo/Core/Utils/Util.php
index a567a82fd4..03b4522f47 100644
--- a/application/Espo/Core/Utils/Util.php
+++ b/application/Espo/Core/Utils/Util.php
@@ -665,10 +665,6 @@ class Util
*/
public static function generateCryptId(): string
{
- if (!function_exists('random_bytes')) {
- return self::generateMoreEntropyId();
- }
-
return bin2hex(random_bytes(16));
}