public function RealAESEncryptionMethod::checkDependencies in Real AES 8.2
Same name and namespace in other branches
- 8 src/Plugin/EncryptionMethod/RealAESEncryptionMethod.php \Drupal\real_aes\Plugin\EncryptionMethod\RealAESEncryptionMethod::checkDependencies()
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/ RealAESEncryptionMethod.php, line 28
Class
- RealAESEncryptionMethod
- Class RealAESEncryptionMethod.
Namespace
Drupal\real_aes\Plugin\EncryptionMethodCode
public function checkDependencies($text = NULL, $key = NULL) {
$errors = [];
if (!class_exists('\\Defuse\\Crypto\\Crypto')) {
$errors[] = $this
->t('Defuse PHP Encryption library is not correctly installed.');
}
// Check if the key size meets the requirement.
if (strlen($key) != Key::KEY_BYTE_SIZE) {
$errors[] = $this
->t("This encryption method requires a @size byte key.", [
'@size' => Key::KEY_BYTE_SIZE,
]);
}
return $errors;
}