diff options
-rw-r--r-- | TODO | 3 | ||||
-rw-r--r-- | context.cpp | 51 | ||||
-rw-r--r-- | context.h | 1 |
3 files changed, 27 insertions, 28 deletions
@@ -23,6 +23,8 @@ Release 0.3.1 - put keydetails to keylist - dont hide verifynotification {DONE] - import from keyserver doesn't end, if network-connection is available, but no connection to keyserver +- refresh verify after import of keys +- replace hardcoded urls in keyserverimport BUGS: - Sometimes two or more stars are shown at modified documents @@ -30,6 +32,7 @@ BUGS: - show, if message is partially verified(how)? Release 0.3.2 +- Change private key password (catch bad passphrase message) - Wizard on first start (Create Key, Import from older gpg4usb, import from gnupg) - GPLv3 - check and add missing statusbar messages diff --git a/context.cpp b/context.cpp index 7ba5fb9..812c529 100644 --- a/context.cpp +++ b/context.cpp @@ -544,33 +544,6 @@ gpgme_signature_t Context::verify(QByteArray inBuffer) { */ //} -void Context::sign(const QByteArray &inBuffer, QByteArray *outBuffer) { - - gpgme_error_t err; - gpgme_data_t in=NULL, out=NULL; - gpgme_sign_result_t result; - -/* - `GPGME_SIG_MODE_NORMAL' - A normal signature is made, the output includes the plaintext - and the signature. - - `GPGME_SIG_MODE_DETACH' - A detached signature is made. - - `GPGME_SIG_MODE_CLEAR' - A clear text signature is made. The ASCII armor and text - mode settings of the context are ignored. -*/ - - //err = gpgme_op_sign (mCtx, in, out, GPGME_SIG_MODE_NORMAL); - err = gpgme_op_sign (mCtx, in, out, GPGME_SIG_MODE_CLEAR); - checkErr(err); - result = gpgme_op_sign_result (mCtx); - - err = readToBuffer(out, outBuffer); -} - bool Context::sign(QStringList *uidList, const QByteArray &inBuffer, QByteArray *outBuffer ) { gpgme_error_t err; @@ -605,10 +578,34 @@ bool Context::sign(QStringList *uidList, const QByteArray &inBuffer, QByteArray err = gpgme_data_new (&out); checkErr(err); + /* + `GPGME_SIG_MODE_NORMAL' + A normal signature is made, the output includes the plaintext + and the signature. + + `GPGME_SIG_MODE_DETACH' + A detached signature is made. + + `GPGME_SIG_MODE_CLEAR' + A clear text signature is made. The ASCII armor and text + mode settings of the context are ignored. + */ + err = gpgme_op_sign (mCtx, in, out, GPGME_SIG_MODE_CLEAR); checkErr (err); + + if (err == GPG_ERR_CANCELED) { + return false; + } + + if (err != GPG_ERR_NO_ERROR) { + QMessageBox::critical(0, tr("Error signing:"), gpgme_strerror(err)); + return false; + } + result = gpgme_op_sign_result (mCtx); err = readToBuffer(out, outBuffer); + checkErr (err); gpgme_data_release(in); gpgme_data_release(out); @@ -88,7 +88,6 @@ public: gpgme_key_t getKeyDetails(QString uid); gpgme_signature_t verify(QByteArray in); // void decryptVerify(QByteArray in); - void sign(const QByteArray &inBuffer, QByteArray *outBuffer); bool sign(QStringList *uidList, const QByteArray &inBuffer, QByteArray *outBuffer ); /** * @details If text contains PGP-message, put a linebreak before the message, |