Aleksander Machniak
2016-03-28 46f7b7096450939fe03c95aa81ce06ae4bfca89d
plugins/enigma/lib/enigma_driver.php
@@ -1,20 +1,14 @@
<?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.                           |
 | Copyright (C) 2010-2015 The Roundcube Dev Team                          |
 |                                                                         |
 | 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.             |
 | Licensed under the GNU General Public License version 3 or              |
 | any later version with exceptions for skins & plugins.                  |
 | See the README file for a full license statement.                       |
 |                                                                         |
 +-------------------------------------------------------------------------+
 | Author: Aleksander Machniak <alec@alec.pl>                              |
@@ -39,11 +33,16 @@
    /**
     * Encryption.
     *
     * @param string Message body
     * @param array  List of key-password mapping
     *
     * @return mixed Encrypted message or enigma_error on failure
     */
    abstract function encrypt($text, $keys);
    /**
     * Decryption..
     * Decryption.
     *
     * @param string Encrypted message
     * @param array  List of key-password mapping
@@ -52,8 +51,15 @@
    /**
     * Signing.
     *
     * @param string Message body
     * @param string Key ID
     * @param string Key password
     * @param int    Signing mode (enigma_engine::SIGN_*)
     *
     * @return mixed True on success or enigma_error on failure
     */
    abstract function sign($text, $key, $passwd);
    abstract function sign($text, $key, $passwd, $mode = null);
    /**
     * Signature verification.
@@ -73,7 +79,16 @@
     *
     * @return mixed Import status array or enigma_error
     */
    abstract function import($content, $isfile=false);
    abstract function import($content, $isfile = false);
    /**
     * Key/Cert export.
     *
     * @param string Key ID
     *
     * @return mixed Key content or enigma_error
     */
    abstract function export($key);
    /**
     * Keys listing.
@@ -82,7 +97,7 @@
     *
     * @return mixed Array of enigma_key objects or enigma_error
     */
    abstract function list_keys($pattern='');
    abstract function list_keys($pattern = '');
    /**
     * Single key information.
@@ -96,7 +111,7 @@
    /**
     * Key pair generation.
     *
     * @param array Key/User data
     * @param array Key/User data (name, email, password, size)
     *
     * @return mixed Key (enigma_key) object or enigma_error
     */
@@ -104,6 +119,10 @@
    /**
     * Key deletion.
     *
     * @param string Key ID
     *
     * @return mixed True on success or enigma_error
     */
    abstract function delete_key($keyid);
}