1
2/*
3 +------------------------------------------------------------------------+
4 | Phalcon Framework                                                      |
5 +------------------------------------------------------------------------+
6 | Copyright (c) 2011-2017 Phalcon Team (https://phalconphp.com)          |
7 +------------------------------------------------------------------------+
8 | This source file is subject to the New BSD License that is bundled     |
9 | with this package in the file LICENSE.txt.                             |
10 |                                                                        |
11 | If you did not receive a copy of the license and are unable to         |
12 | obtain it through the world-wide-web, please send an email             |
13 | to license@phalconphp.com so we can send you a copy immediately.       |
14 +------------------------------------------------------------------------+
15 | Authors: Andres Gutierrez <andres@phalconphp.com>                      |
16 |          Eduar Carvajal <eduar@phalconphp.com>                         |
17 +------------------------------------------------------------------------+
18 */
19
20namespace Phalcon;
21
22/**
23 * Phalcon\CryptInterface
24 *
25 * Interface for Phalcon\Crypt
26 */
27interface CryptInterface
28{
29
30	/**
31	 * Sets the cipher algorithm
32	 */
33	public function setCipher(string! cipher) -> <CryptInterface>;
34
35	/**
36	 * Returns the current cipher
37	 */
38	public function getCipher() -> string;
39
40	/**
41	 * Sets the encryption key
42	 */
43	public function setKey(string! key) -> <CryptInterface>;
44
45	/**
46	 * Returns the encryption key
47	 */
48	public function getKey() -> string;
49
50	/**
51	 * Encrypts a text
52	 */
53	public function encrypt(string! text, string! key = null) -> string;
54
55	/**
56	 * Decrypts a text
57	 */
58	public function decrypt(string! text, string! key = null) -> string;
59
60	/**
61	 * Encrypts a text returning the result as a base64 string
62	 */
63	public function encryptBase64(string! text, key = null) -> string;
64
65	/**
66	 * Decrypt a text that is coded as a base64 string
67	 */
68	public function decryptBase64(string! text, key = null) -> string;
69
70	/**
71	 * Returns a list of available cyphers
72	 */
73	public function getAvailableCiphers() -> array;
74
75}
76