aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910>2011-10-14 19:40:51 +0000
committerubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910>2011-10-14 19:40:51 +0000
commit81f36890cb3e5afb432fe7894687345099dd6823 (patch)
tree031f9ef6c9b9a8ddb09320f98930a358192c56a9
parentverifynotification and verifydetailsdialog is refreshed on keylist-change, bt... (diff)
downloadgpg4usb-81f36890cb3e5afb432fe7894687345099dd6823.tar.gz
gpg4usb-81f36890cb3e5afb432fe7894687345099dd6823.zip
return false in sign method if user canceld password input to prevent text-loss, remove unused method
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@547 34ebc366-c3a9-4b3c-9f84-69acf7962910
-rw-r--r--TODO3
-rw-r--r--context.cpp51
-rw-r--r--context.h1
3 files changed, 27 insertions, 28 deletions
diff --git a/TODO b/TODO
index 9ea10b2..763716f 100644
--- a/TODO
+++ b/TODO
@@ -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);
diff --git a/context.h b/context.h
index 6c58455..7ca00d5 100644
--- a/context.h
+++ b/context.h
@@ -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,