8
8
namespace Drupal \encrypt ;
9
9
10
10
use Drupal \Core \Entity \EntityManagerInterface ;
11
- use Drupal \key \KeyManager ;
11
+ use Drupal \key \KeyRepository ;
12
12
13
13
/**
14
14
* Class EncryptService.
@@ -28,17 +28,17 @@ class EncryptService implements EncryptServiceInterface {
28
28
protected $ encryptManager ;
29
29
30
30
/**
31
- * @var \Drupal\key\KeyManager
31
+ * @var \Drupal\key\KeyRepository
32
32
*/
33
33
protected $ key ;
34
34
35
35
36
36
/**
37
37
* @param \Drupal\Core\Entity\EntityManagerInterface $entityManager
38
38
* @param \Drupal\encrypt\EncryptionMethodManager $manager
39
- * @param \Drupal\key\KeyManager $key
39
+ * @param \Drupal\key\KeyRepository $key
40
40
*/
41
- public function __construct (EntityManagerInterface $ entityManager , EncryptionMethodManager $ encryptManager , KeyManager $ key ) {
41
+ public function __construct (EntityManagerInterface $ entityManager , EncryptionMethodManager $ encryptManager , KeyRepository $ key ) {
42
42
$ this ->entityManager = $ entityManager ;
43
43
$ this ->encryptManager = $ encryptManager ;
44
44
$ this ->key = $ key ;
@@ -74,9 +74,9 @@ public function encrypt($text, $inst_id = NULL) {
74
74
// Load the key.
75
75
$ key_id = $ enc_profile ->getEncryptionKey ();
76
76
if ($ key_id != 'default ' ) {
77
- $ key_value = $ this ->key ->getKeyValue ($ key_id );
77
+ $ key_value = $ this ->key ->getKey ($ key_id)-> getKeyValue ( );
78
78
} else {
79
- $ key_value = $ this ->key ->getDefaultKeyValue ();
79
+ $ key_value = $ this ->key ->getKey ()-> getKeyValue ();
80
80
}
81
81
82
82
// Load the encryption method.
@@ -108,9 +108,9 @@ public function decrypt($text, $inst_id = NULL) {
108
108
// Load the key.
109
109
$ key_id = $ enc_profile ->getEncryptionKey ();
110
110
if ($ key_id != 'default ' ) {
111
- $ key_value = $ this ->key ->getKeyValue ($ key_id );
111
+ $ key_value = $ this ->key ->getKey ($ key_id)-> getKeyValue ( );
112
112
} else {
113
- $ key_value = $ this ->key ->getDefaultKeyValue ();
113
+ $ key_value = $ this ->key ->getKey ()-> getKeyValue ();
114
114
}
115
115
116
116
// Load the encryption method.
0 commit comments