From 211929876b84beba330a8fed2130feaed616cd9f Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sun, 06 Sep 2015 09:52:31 -0400
Subject: [PATCH] Enigma: GPG keys export

---
 plugins/enigma/lib/enigma_engine.php |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/plugins/enigma/lib/enigma_engine.php b/plugins/enigma/lib/enigma_engine.php
index 58982ca..aa6a728 100644
--- a/plugins/enigma/lib/enigma_engine.php
+++ b/plugins/enigma/lib/enigma_engine.php
@@ -1003,6 +1003,37 @@
     }
 
     /**
+     * PGP keys/certs export..
+     *
+     * @param string   Key ID
+     * @param resource Optional output stream
+     *
+     * @return mixed Key content or enigma_error
+     */
+    function export_key($key, $fp = null)
+    {
+        $this->load_pgp_driver();
+        $result = $this->pgp_driver->export($key, $fp);
+
+        if ($result instanceof enigma_error) {
+            rcube::raise_error(array(
+                'code' => 600, 'type' => 'php',
+                'file' => __FILE__, 'line' => __LINE__,
+                'message' => "Enigma plugin: " . $result->getMessage()
+                ), true, false);
+
+            return $result;
+        }
+
+        if ($fp) {
+            fwrite($fp, $result);
+        }
+        else {
+            return $result;
+        }
+    }
+
+    /**
      * Registers password for specified key/cert sent by the password prompt.
      */
     function password_handler()

--
Gitblit v1.9.1