You are here

private function McryptAES128Encryption::decryptLegacyDataWithOpenSsl in Two-factor Authentication (TFA) 8

Use OpenSSL to decrypt data that was originally encrypted with Mcrypt.

Parameters

string $text: The text to be decrypted.

string $key: The key to decrypt the text with.

Return value

string|bool The decrypted text, or FALSE on failure.

1 call to McryptAES128Encryption::decryptLegacyDataWithOpenSsl()
McryptAES128Encryption::decrypt in src/Plugin/EncryptionMethod/McryptAES128Encryption.php
Decrypt text.

File

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

Class

McryptAES128Encryption
Deprecated Mcrypt AES 128 encryption plugin.

Namespace

Drupal\tfa\Plugin\EncryptionMethod

Code

private function decryptLegacyDataWithOpenSsl($text, $key) {
  $key = mb_substr($key, 0, 32);
  $text = base64_decode($text);
  return openssl_decrypt($text, 'aes-128-cbc', $key, OPENSSL_NO_PADDING);
}