summaryrefslogtreecommitdiff
path: root/plugins/enigma/lib/enigma_driver.php
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2012-03-31 12:25:48 +0000
committerthomascube <thomas@roundcube.net>2012-03-31 12:25:48 +0000
commit48e9c14ebded89d858c8be0333f77f77a81b0877 (patch)
treee97fd2ea338eea2dbe5f3fb7431e73f44cb8bf18 /plugins/enigma/lib/enigma_driver.php
parent13db9ee199b0a452a6efaf09e6f7c5a76f739ef5 (diff)
Move plugins repository into roundcubemail root folder; svn:externals are not defined anymore
Diffstat (limited to 'plugins/enigma/lib/enigma_driver.php')
-rw-r--r--plugins/enigma/lib/enigma_driver.php106
1 files changed, 106 insertions, 0 deletions
diff --git a/plugins/enigma/lib/enigma_driver.php b/plugins/enigma/lib/enigma_driver.php
new file mode 100644
index 000000000..a9a3e4715
--- /dev/null
+++ b/plugins/enigma/lib/enigma_driver.php
@@ -0,0 +1,106 @@
+<?php
+/*
+ +-------------------------------------------------------------------------+
+ | Abstract driver for the Enigma Plugin |
+ | |
+ | This program is free software; you can redistribute it and/or modify |
+ | it under the terms of the GNU General Public License version 2 |
+ | as published by the Free Software Foundation. |
+ | |
+ | This program is distributed in the hope that it will be useful, |
+ | but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+ | GNU General Public License for more details. |
+ | |
+ | You should have received a copy of the GNU General Public License along |
+ | with this program; if not, write to the Free Software Foundation, Inc., |
+ | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
+ | |
+ +-------------------------------------------------------------------------+
+ | Author: Aleksander Machniak <alec@alec.pl> |
+ +-------------------------------------------------------------------------+
+*/
+
+abstract class enigma_driver
+{
+ /**
+ * Class constructor.
+ *
+ * @param string User name (email address)
+ */
+ abstract function __construct($user);
+
+ /**
+ * Driver initialization.
+ *
+ * @return mixed NULL on success, enigma_error on failure
+ */
+ abstract function init();
+
+ /**
+ * Encryption.
+ */
+ abstract function encrypt($text, $keys);
+
+ /**
+ * Decryption..
+ */
+ abstract function decrypt($text, $key, $passwd);
+
+ /**
+ * Signing.
+ */
+ abstract function sign($text, $key, $passwd);
+
+ /**
+ * Signature verification.
+ *
+ * @param string Message body
+ * @param string Signature, if message is of type PGP/MIME and body doesn't contain it
+ *
+ * @return mixed Signature information (enigma_signature) or enigma_error
+ */
+ abstract function verify($text, $signature);
+
+ /**
+ * Key/Cert file import.
+ *
+ * @param string File name or file content
+ * @param bollean True if first argument is a filename
+ *
+ * @return mixed Import status array or enigma_error
+ */
+ abstract function import($content, $isfile=false);
+
+ /**
+ * Keys listing.
+ *
+ * @param string Optional pattern for key ID, user ID or fingerprint
+ *
+ * @return mixed Array of enigma_key objects or enigma_error
+ */
+ abstract function list_keys($pattern='');
+
+ /**
+ * Single key information.
+ *
+ * @param string Key ID, user ID or fingerprint
+ *
+ * @return mixed Key (enigma_key) object or enigma_error
+ */
+ abstract function get_key($keyid);
+
+ /**
+ * Key pair generation.
+ *
+ * @param array Key/User data
+ *
+ * @return mixed Key (enigma_key) object or enigma_error
+ */
+ abstract function gen_key($data);
+
+ /**
+ * Key deletion.
+ */
+ abstract function del_key($keyid);
+}