protected function WebformEncryptSubmissionStorage::encrypt in Webform Encrypt 8
Encrypts a string.
Parameters
string $string: The string to be decrypted.
\Drupal\encrypt\EncryptionProfileInterface $encryption_profile: The encryption profile to be used to encrypt the string.
Return value
string The serialized encrypted value.
Throws
\Drupal\encrypt\Exception\EncryptException
2 calls to WebformEncryptSubmissionStorage::encrypt()
- WebformEncryptSubmissionStorage::encryptChildren in src/WebformEncryptSubmissionStorage.php 
- Helper function to recursively encrypt children of fields.
- WebformEncryptSubmissionStorage::encryptElements in src/WebformEncryptSubmissionStorage.php 
- Helper function to recursively encrypt fields.
File
- src/WebformEncryptSubmissionStorage.php, line 145 
Class
- WebformEncryptSubmissionStorage
- Alter webform submission storage definitions.
Namespace
Drupal\webform_encryptCode
protected function encrypt($string, EncryptionProfileInterface $encryption_profile) {
  // Serialize the data to include the encryption profile.
  // This is used later to check for changes in the profile.
  $encrypted_data = [
    'data' => $this->encryptionService
      ->encrypt($string, $encryption_profile),
    'encrypt_profile' => $encryption_profile
      ->id(),
  ];
  return serialize($encrypted_data);
}