Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.0] Removing MCrypt class #38713

Open
wants to merge 7 commits into
base: 6.0-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
195 changes: 0 additions & 195 deletions libraries/src/Encrypt/AES/Mcrypt.php

This file was deleted.

25 changes: 3 additions & 22 deletions libraries/src/Encrypt/Aes.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@
namespace Joomla\CMS\Encrypt;

use Joomla\CMS\Encrypt\AES\AesInterface;
use Joomla\CMS\Encrypt\AES\Mcrypt;
use Joomla\CMS\Encrypt\AES\OpenSSL;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
* A simple implementation of AES-128, AES-192 and AES-256 encryption using the
* high performance mcrypt library.
* A simple implementation of AES-128, AES-192 and AES-256 encryption using OpenSSL.
*
* @since 1.0
*/
Expand Down Expand Up @@ -55,20 +53,7 @@ class Aes
*/
public function __construct($key, $strength = 128, $mode = 'cbc', $priority = 'openssl')
Hackwar marked this conversation as resolved.
Show resolved Hide resolved
{
if ($priority === 'openssl') {
$this->adapter = new OpenSSL();

if (!$this->adapter->isSupported()) {
$this->adapter = new Mcrypt();
}
} else {
$this->adapter = new Mcrypt();

if (!$this->adapter->isSupported()) {
$this->adapter = new OpenSSL();
}
}

$this->adapter = new OpenSSL();
$this->adapter->setEncryptionMode($mode, $strength);
$this->setPassword($key, true);
}
Expand Down Expand Up @@ -168,11 +153,7 @@ public static function isSupported()
$adapter = new OpenSSL();

if (!$adapter->isSupported()) {
$adapter = new Mcrypt();

if (!$adapter->isSupported()) {
return false;
}
return false;
}

if (!\function_exists('base64_encode')) {
Expand Down