public function EncryptService::encrypt in Encrypt 8.3
Main encrypt function.
Parameters
string $text: The plain text to encrypt.
\Drupal\encrypt\EncryptionProfileInterface $encryption_profile: The encryption profile entity.
Return value
string The encrypted string.
Throws
\Drupal\encrypt\Exception\EncryptException Can throw an EncryptException.
Overrides EncryptServiceInterface::encrypt
File
- src/
EncryptService.php, line 77
Class
- EncryptService
- Class EncryptService.
Namespace
Drupal\encryptCode
public function encrypt($text, EncryptionProfileInterface $encryption_profile) {
if ($this
->validate($text, $encryption_profile)) {
$key = $encryption_profile
->getEncryptionKey();
return $encryption_profile
->getEncryptionMethod()
->encrypt($text, $key
->getKeyValue());
}
}