From a274da36798b7aa7a7cbc9e85ec30748fa66047e Mon Sep 17 00:00:00 2001 From: ubbo Date: Fri, 3 Aug 2012 20:38:27 +0000 Subject: start porting encrypt from kgpg, not yet working git-svn-id: http://cpunk.de/svn/src/gpg4usb/branches/0.3.2-mac@932 34ebc366-c3a9-4b3c-9f84-69acf7962910 --- gpgcontext.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'gpgcontext.cpp') diff --git a/gpgcontext.cpp b/gpgcontext.cpp index f87ed11..a6dec21 100644 --- a/gpgcontext.cpp +++ b/gpgcontext.cpp @@ -24,6 +24,7 @@ #include "kgpg/kgpginterface.h" #include "kgpg/klinebufferedprocess.h" #include "kgpg/core/kgpgkey.h" +#include "kgpg/transactions/kgpgencrypt.h" #ifdef _WIN32 #include #include /* contains read/write */ @@ -274,7 +275,7 @@ void GpgContext::deleteKeys(QStringList *uidList) bool GpgContext::encrypt(QStringList *uidList, const QByteArray &inBuffer, QByteArray *outBuffer) { - gpgme_data_t in = 0, out = 0; + /*gpgme_data_t in = 0, out = 0; outBuffer->resize(0); if (uidList->count() == 0) { @@ -285,7 +286,7 @@ bool GpgContext::encrypt(QStringList *uidList, const QByteArray &inBuffer, QByte //gpgme_encrypt_result_t e_result; gpgme_key_t recipients[uidList->count()+1]; - /* get key for user */ + // get key for user for (int i = 0; i < uidList->count(); i++) { // the last 0 is for public keys, 1 would return private keys gpgme_op_keylist_start(mCtx, uidList->at(i).toAscii().constData(), 0); @@ -312,7 +313,7 @@ bool GpgContext::encrypt(QStringList *uidList, const QByteArray &inBuffer, QByte } } } - /* unref all keys */ + // unref all keys for (int i = 0; i <= uidList->count(); i++) { gpgme_key_unref(recipients[i]); } @@ -322,9 +323,17 @@ bool GpgContext::encrypt(QStringList *uidList, const QByteArray &inBuffer, QByte if (out) { gpgme_data_release(out); } - return (err == GPG_ERR_NO_ERROR); + return (err == GPG_ERR_NO_ERROR);*/ + QStringList options; + KGpgEncrypt::EncryptOptions opts = KGpgEncrypt::DefaultEncryption; + + //KGpgEncrypt *encr = new KGpgEncrypt(this, uidList, toPlainText(), opts, options); + //encr->start(); + //connect(encr, SIGNAL(done(int)), SLOT(slotEncodeUpdate(int))); } + + /** Decrypt QByteAarray, return QByteArray * mainly from http://basket.kde.org/ (kgpgme.cpp) */ -- cgit v1.2.3