Change record status: 
Project: 
Introduced in branch: 
4.x
Introduced in version: 
4.0.0
Description: 

Previously, EncryptionMethodInterface::encrypt(), ::decrypt() and ::checkDependencies() received the key value as a string. These methods now receive the Key entity (\Drupal\key\KeyInterface) itself.

All custom encryption methods must be updated to the new signature.

To migrate, retype the $key parameter and call $key->getKeyValue() where you previously used the string directly:

Before:

public function encrypt(#[\SensitiveParameter] $text, #[\SensitiveParameter] $key) {
  return my_cipher_encrypt($text, $key);
}

After:

use Drupal\key\KeyInterface;

public function encrypt(#[\SensitiveParameter] $text, #[\SensitiveParameter] KeyInterface $key) {
  return my_cipher_encrypt($text, $key->getKeyValue());
}
Impacts: 
Module developers