3 +-------------------------------------------------------------------------+
4 | Abstract driver for the Enigma Plugin |
6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License version 2 |
8 | as published by the Free Software Foundation. |
10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. |
15 | You should have received a copy of the GNU General Public License along |
16 | with this program; if not, write to the Free Software Foundation, Inc., |
17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
19 +-------------------------------------------------------------------------+
20 | Author: Aleksander Machniak <alec@alec.pl> |
21 +-------------------------------------------------------------------------+
24 abstract class enigma_driver
29 * @param string User name (email address)
31 abstract function __construct($user);
34 * Driver initialization.
36 * @return mixed NULL on success, enigma_error on failure
38 abstract function init();
43 abstract function encrypt($text, $keys);
48 abstract function decrypt($text, $key, $passwd);
53 abstract function sign($text, $key, $passwd);
56 * Signature verification.
58 * @param string Message body
59 * @param string Signature, if message is of type PGP/MIME and body doesn't contain it
61 * @return mixed Signature information (enigma_signature) or enigma_error
63 abstract function verify($text, $signature);
66 * Key/Cert file import.
68 * @param string File name or file content
69 * @param bollean True if first argument is a filename
71 * @return mixed Import status array or enigma_error
73 abstract function import($content, $isfile=false);
78 * @param string Optional pattern for key ID, user ID or fingerprint
80 * @return mixed Array of enigma_key objects or enigma_error
82 abstract function list_keys($pattern='');
85 * Single key information.
87 * @param string Key ID, user ID or fingerprint
89 * @return mixed Key (enigma_key) object or enigma_error
91 abstract function get_key($keyid);
94 * Key pair generation.
96 * @param array Key/User data
98 * @return mixed Key (enigma_key) object or enigma_error
100 abstract function gen_key($data);
105 abstract function del_key($keyid);