aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gpgcontext.cpp11
-rw-r--r--gpgcontext.h2
2 files changed, 10 insertions, 3 deletions
diff --git a/gpgcontext.cpp b/gpgcontext.cpp
index 1810a9a..b9c2567 100644
--- a/gpgcontext.cpp
+++ b/gpgcontext.cpp
@@ -639,11 +639,12 @@ gpgme_signature_t GpgContext::verify(QByteArray inBuffer) {
*/
//}
-bool GpgContext::sign(QStringList *uidList, const QByteArray &inBuffer, QByteArray *outBuffer ) {
+bool GpgContext::sign(QStringList *uidList, const QByteArray &inBuffer, QByteArray *outBuffer, bool detached) {
gpgme_error_t err;
gpgme_data_t in, out;
gpgme_sign_result_t result;
+ gpgme_sig_mode_t mode;
if (uidList->count() == 0) {
QMessageBox::critical(0, tr("Key Selection"), tr("No Private Key Selected"));
@@ -686,7 +687,13 @@ bool GpgContext::sign(QStringList *uidList, const QByteArray &inBuffer, QByteArr
mode settings of the context are ignored.
*/
- err = gpgme_op_sign (mCtx, in, out, GPGME_SIG_MODE_CLEAR);
+ if(detached) {
+ mode = GPGME_SIG_MODE_DETACH;
+ } else {
+ mode = GPGME_SIG_MODE_CLEAR;
+ }
+
+ err = gpgme_op_sign (mCtx, in, out, mode);
checkErr (err);
if (err == GPG_ERR_CANCELED) {
diff --git a/gpgcontext.h b/gpgcontext.h
index 76f753e..a01ff8d 100644
--- a/gpgcontext.h
+++ b/gpgcontext.h
@@ -121,7 +121,7 @@ public:
gpgme_key_t getKeyDetails(QString uid);
gpgme_signature_t verify(QByteArray in);
// void decryptVerify(QByteArray in);
- bool sign(QStringList *uidList, const QByteArray &inBuffer, QByteArray *outBuffer );
+ bool sign(QStringList *uidList, const QByteArray &inBuffer, QByteArray *outBuffer, bool detached = false);
/**
* @details If text contains PGP-message, put a linebreak before the message,
* so that gpgme can decrypt correctly