diff --git a/typo3/sysext/core/Classes/Crypto/HashService.php b/typo3/sysext/core/Classes/Crypto/HashService.php index c783c9d46bc0ce7124c8f88ce4fb750dd1f8c6f1..d4716e89b4a09bd60f5b4d6810a993fd1c305ec6 100644 --- a/typo3/sysext/core/Classes/Crypto/HashService.php +++ b/typo3/sysext/core/Classes/Crypto/HashService.php @@ -17,7 +17,6 @@ declare(strict_types=1); namespace TYPO3\CMS\Core\Crypto; -use TYPO3\CMS\Core\Exception\Crypto\EmptyAdditionalSecretException; use TYPO3\CMS\Core\Exception\Crypto\InvalidHashStringException; use TYPO3\CMS\Core\SingletonInterface; @@ -35,7 +34,7 @@ final class HashService implements SingletonInterface public function hmac(string $input, string $additionalSecret): string { if ($additionalSecret === '') { - throw new EmptyAdditionalSecretException('The ' . __METHOD__ . ' function requires a non-empty additional secret.', 1704453167); + throw new \LogicException('The ' . __METHOD__ . ' function requires a non-empty additional secret.', 1704453167); } $secret = $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] . $additionalSecret; diff --git a/typo3/sysext/core/Classes/Exception/Crypto/EmptyAdditionalSecretException.php b/typo3/sysext/core/Classes/Exception/Crypto/EmptyAdditionalSecretException.php deleted file mode 100644 index cd6675f9c406a6d8a00f0f4cbf19f2c105c76b60..0000000000000000000000000000000000000000 --- a/typo3/sysext/core/Classes/Exception/Crypto/EmptyAdditionalSecretException.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ - -namespace TYPO3\CMS\Core\Exception\Crypto; - -use TYPO3\CMS\Core\Exception; - -/** - * Exception thrown if Hash::hmac() function has an empty $additionalSecret parameter - */ -final class EmptyAdditionalSecretException extends Exception {} diff --git a/typo3/sysext/core/Tests/Unit/Crypto/HashServiceTest.php b/typo3/sysext/core/Tests/Unit/Crypto/HashServiceTest.php index 073b78eaf8681997eba085f1fe71679994ec9fe7..85bc1172517c90cb794b25055d63fe6e99b38327 100644 --- a/typo3/sysext/core/Tests/Unit/Crypto/HashServiceTest.php +++ b/typo3/sysext/core/Tests/Unit/Crypto/HashServiceTest.php @@ -19,7 +19,6 @@ namespace TYPO3\CMS\Core\Tests\Unit\Crypto; use PHPUnit\Framework\Attributes\Test; use TYPO3\CMS\Core\Crypto\HashService; -use TYPO3\CMS\Core\Exception\Crypto\EmptyAdditionalSecretException; use TYPO3\CMS\Core\Exception\Crypto\InvalidHashStringException; use TYPO3\TestingFramework\Core\Unit\UnitTestCase; @@ -37,7 +36,7 @@ final class HashServiceTest extends UnitTestCase #[Test] public function hmacThrowsExceptionIfEmptyAdditionalSecretProvided(): void { - $this->expectException(EmptyAdditionalSecretException::class); + $this->expectException(\LogicException::class); // @phpstan-ignore-next-line We are explicitly testing a contract violation here. $this->subject->hmac('message', '');