You are here

public static function AES::get_available_implementations in AES encryption 8.2

Retrieve information about available AES implementations.

Return value

array

2 calls to AES::get_available_implementations()
aes_install in ./aes.install
Implements hook_install().
aes_requirements in ./aes.install
Implements hook_requirements().

File

src/AES.php, line 16

Class

AES

Namespace

Drupal\aes

Code

public static function get_available_implementations() {
  $phpsec_available = FALSE;
  if (\Drupal::moduleHandler()
    ->moduleExists('libraries') && libraries_get_path('phpseclib')) {
    $phpsec_include_path = libraries_get_path('phpseclib');
    set_include_path(get_include_path() . PATH_SEPARATOR . $phpsec_include_path);
    $phpsec_available = is_readable($phpsec_include_path . '/Crypt/AES.php');
  }
  $mcrypt_available = extension_loaded('mcrypt');
  return array(
    'mcrypt' => $mcrypt_available,
    'phpseclib' => $phpsec_available,
  );
}