Repository navigation
Expand file tree
/
Copy pathEncryptedDataInterface.php
More file actions
53 lines (47 loc) · 2.16 KB
/
Copy pathEncryptedDataInterface.php
File metadata and controls
53 lines (47 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
namespace ProcessMaker\EncryptedData;
interface EncryptedDataInterface
{
/**
* Encrypting a text using the current driver
*
* @param string $plainText The text to encrypt.
* @param string $iv|null This parameter is always optional when the configured driver is "vault",
* as the vault handles it internally. It can also be optional when the IV is obtained from the database
* instead of generating a new one.
* @param string $key|null This parameter is always optional when the configured driver is "vault",
* as the vault manages the keys. It is also optional when performing regular encryption with
* the "local" driver. In this case, the current key is obtained from the environment parameters.
*
* @return string
*/
public function encryptText(string $plainText, string $iv = null, string $key = null): string;
/**
* Decrypting a text using the current driver
*
* @param string $cipherText The cipher text to decrypt.
* @param string $iv|null This parameter is always optional when the configured driver is "vault",
* as the vault handles it internally. It can also be optional when the IV is obtained from the database
* instead of generating a new one.
* @param string $key|null This parameter is always optional when the configured driver is "vault",
* as the vault manages the keys. It is also optional when performing regular decryption with
* the "local" driver. In this case, the current key is obtained from the environment parameters.
*
* @return string
*/
public function decryptText(string $cipherText, string $iv = null, string $key = null): string;
/**
* Update the encrypted texts stored in the database using a new key.
* In the case of the "local" driver, the new key is updated in the environment variables.
* In the case of the "vault" driver, the Vault administrator must rotate the key before executing this action.
*/
public function changeKey(): void;
/**
* Set IV value
*/
public function setIv(string $iv): void;
/**
* Get IV value
*/
public function getIv(): string;
}