You are here

public function McryptAES128Encryption::checkDependencies in Two-factor Authentication (TFA) 8

Check dependencies for the encryption method.

Parameters

string $text: The text to be checked.

string $key: The key to be checked.

Return value

array An array of error messages, providing info on missing dependencies.

Overrides EncryptionMethodInterface::checkDependencies

File

src/Plugin/EncryptionMethod/McryptAES128Encryption.php, line 149

Class

McryptAES128Encryption
Deprecated Mcrypt AES 128 encryption plugin.

Namespace

Drupal\tfa\Plugin\EncryptionMethod

Code

public function checkDependencies($text = NULL, $key = NULL) {
  $errors = [];
  if (!extension_loaded('openssl') && !extension_loaded('mcrypt')) {
    $errors[] = $this
      ->t('OpenSSL and Mcrypt extensions are not installed.');
  }

  // Check if we have a 128 bit key.
  if (strlen($key) != 16) {
    $errors[] = $this
      ->t('This encryption method requires a 128 bit key.');
  }
  return $errors;
}