From ca5aa8edf04023e454649baf56e8dd43536f65c3 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Wed, 19 Mar 2025 13:55:15 +0200 Subject: [PATCH] remove no random_bytes fallback --- .../Core/Authentication/AuthToken/EspoManager.php | 13 +------------ application/Espo/Core/Utils/Util.php | 4 ---- 2 files changed, 1 insertion(+), 16 deletions(-) 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)); }