From 277aa42c41bf77419f11fb041fbf11cb98538346 Mon Sep 17 00:00:00 2001 From: Justas Brazauskas Date: Tue, 18 Mar 2025 11:31:59 +0200 Subject: [PATCH 1/2] Remove mcrypt --- .travis.yml | 1 - composer.json | 1 - .../Ntlm/Crypt/Des/McryptDesEncrypter.php | 70 --------------- .../Random/McryptRandomByteGenerator.php | 90 ------------------- 4 files changed, 162 deletions(-) delete mode 100644 src/Robin/Ntlm/Crypt/Des/McryptDesEncrypter.php delete mode 100644 src/Robin/Ntlm/Crypt/Random/McryptRandomByteGenerator.php diff --git a/.travis.yml b/.travis.yml index 367d99f..dc1b6ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,6 @@ matrix: before_install: - export ALLOW_FAILURE=1; if [ "$TRAVIS_PHP_VERSION" != "hhvm" ] && [ "$TRAVIS_PHP_VERSION" != "nightly" ]; then export ALLOW_FAILURE=0; fi - - if [ "$TRAVIS_PHP_VERSION" == "7.2" ]; then yes '' | pecl install mcrypt-1.0.2; fi install: - composer self-update diff --git a/composer.json b/composer.json index 02b2881..f407865 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,6 @@ "php-64bit": ">=7.1.0" }, "require-dev": { - "ext-mcrypt": "*", "ext-hash": "*", "ext-mbstring": "*", "ext-iconv": "*", diff --git a/src/Robin/Ntlm/Crypt/Des/McryptDesEncrypter.php b/src/Robin/Ntlm/Crypt/Des/McryptDesEncrypter.php deleted file mode 100644 index 7b0d205..0000000 --- a/src/Robin/Ntlm/Crypt/Des/McryptDesEncrypter.php +++ /dev/null @@ -1,70 +0,0 @@ - MCRYPT_MODE_CBC, - CipherMode::CFB => MCRYPT_MODE_CFB, - CipherMode::ECB => MCRYPT_MODE_ECB, - CipherMode::OFB => MCRYPT_MODE_OFB, - ]; - - - /** - * Methods - */ - - /** - * {@inheritDoc} - */ - public function encrypt($key, $data, $mode, $initialization_vector) - { - if (isset(self::$cipher_mode_map[$mode])) { - $mode = self::$cipher_mode_map[$mode]; - } else { - throw new InvalidArgumentException('Unknown cipher mode "'. $mode .'"'); - } - - $key = $this->processKey($key); - - $encrypted = mcrypt_encrypt(MCRYPT_DES, $key, $data, $mode, $initialization_vector); - - if (false === $encrypted) { - throw CryptographicFailureException::forReasonCode( - CryptographicFailureException::CODE_FOR_ENCRYPTION_FAILURE - ); - } - - return $encrypted; - } -} diff --git a/src/Robin/Ntlm/Crypt/Random/McryptRandomByteGenerator.php b/src/Robin/Ntlm/Crypt/Random/McryptRandomByteGenerator.php deleted file mode 100644 index d1ca9f6..0000000 --- a/src/Robin/Ntlm/Crypt/Random/McryptRandomByteGenerator.php +++ /dev/null @@ -1,90 +0,0 @@ -source = $source; - } - - /** - * {@inheritDoc} - * - * @deprecated This implementation is deprecated, as the mcrypt - * library is abandoned. Use {@link NativeRandomByteGenerator} instead. - */ - public function generate($size) - { - trigger_error( - 'This implementation is deprecated, as the mcrypt library is abandoned', - E_USER_DEPRECATED - ); - - $generated = mcrypt_create_iv($size, $this->source); - - if (false === $generated || strlen($generated) !== $size) { - throw CryptographicFailureException::forReasonCode( - CryptographicFailureException::CODE_FOR_RANDOM_DATA_GENERATION_FAILURE - ); - } - - return $generated; - } -} From 0462d20604c027cf5d1b9fd7664c71c696071fc1 Mon Sep 17 00:00:00 2001 From: Justas Brazauskas Date: Fri, 21 Mar 2025 10:41:45 +0200 Subject: [PATCH 2/2] Bump php version to at least 8.3 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f407865..635db3c 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "source": "https://github.com/robinpowered/php-ntlm" }, "require": { - "php-64bit": ">=7.1.0" + "php-64bit": ">=8.3.0" }, "require-dev": { "ext-hash": "*",