aboutsummaryrefslogtreecommitdiffstats
path: root/context.cpp
diff options
context:
space:
mode:
authornils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910>2008-10-02 03:45:25 +0200
committernils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910>2008-10-02 03:45:25 +0200
commite7857f4eace1302891a8b983eecb39264a1b918e (patch)
tree209b569ba9195d52e1178cf461e5901bf8a2faae /context.cpp
parentdeleted #include keyutils... (diff)
downloadgpg4usb-e7857f4eace1302891a8b983eecb39264a1b918e.tar.gz
gpg4usb-e7857f4eace1302891a8b983eecb39264a1b918e.zip
added keymanagement including export of keys
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@181 34ebc366-c3a9-4b3c-9f84-69acf7962910
Diffstat (limited to 'context.cpp')
-rw-r--r--context.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/context.cpp b/context.cpp
index 132621d..94a4ea1 100644
--- a/context.cpp
+++ b/context.cpp
@@ -107,6 +107,35 @@ void Context::importKey(QByteArray inBuffer)
gpgme_data_release(in);
}
+/** Export Key to QByteArray
+ *
+ */
+void Context::exportKeys(QList<QString> *uidList, QByteArray *outBuffer)
+{
+ size_t read_bytes;
+ gpgme_data_t out = 0;
+ outBuffer->resize(0);
+
+ if (uidList->count() == 0) {
+ QMessageBox::critical(0, "Export Keys Error", "No Keys Selected");
+ return;
+ }
+
+ for (int i = 0; i < uidList->count(); i++) {
+ err = gpgme_data_new(&out);
+ checkErr(err);
+
+ err = gpgme_op_export(m_ctx, uidList->at(i).toAscii().constData(), 0, out);
+ checkErr(err);
+
+ read_bytes = gpgme_data_seek (out, 0, SEEK_END);
+
+ err = readToBuffer(out, outBuffer);
+ checkErr(err);
+ gpgme_data_release(out);
+ }
+}
+
/** List all availabe Keys (VERY much like kgpgme)
*/
GpgKeyList Context::listKeys()