Merge pull request #22530 from eileenmcnaughton/category
[civicrm-core.git] / Civi / Crypto / CipherSuiteInterface.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
10 */
11 namespace Civi\Crypto;
12
13 /**
14 * @package Civi\Crypt
15 */
16 interface CipherSuiteInterface {
17
18 /**
19 * Get a list of supported cipher suites.
20 *
21 * @return array
22 * Ex: ['aes-cbc', 'aes-bbc', 'aes-pbs']
23 */
24 public function getSuites(): array;
25
26 /**
27 * Encrypt a string
28 *
29 * @param string $plainText
30 * @param array $key
31 *
32 * @return string
33 * Encrypted content as a binary string.
34 * Depending on the suite, this may include related values (eg HMAC + IV).
35 */
36 public function encrypt(string $plainText, array $key): string;
37
38 /**
39 * Decrypt a string
40 *
41 * @param string $cipherText
42 * Encrypted content as a binary string.
43 * Depending on the suite, this may include related values (eg HMAC + IV).
44 * @param array $key
45 *
46 * @return string
47 * Decrypted string
48 */
49 public function decrypt(string $cipherText, array $key): string;
50
51 }