aboutsummaryrefslogtreecommitdiffstats
path: root/context.cpp
diff options
context:
space:
mode:
authornils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910>2011-10-11 20:29:14 +0000
committernils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910>2011-10-11 20:29:14 +0000
commit7df096cffe4806fbc1e13fbcc3170933876a115a (patch)
treeeaeef8024c6466f28a350460f2890a19880e916b /context.cpp
parentsome commenting (diff)
downloadgpg4usb-7df096cffe4806fbc1e13fbcc3170933876a115a.tar.gz
gpg4usb-7df096cffe4806fbc1e13fbcc3170933876a115a.zip
moved preventnodataerr to context.cpp, added refresh slots for verify
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@544 34ebc366-c3a9-4b3c-9f84-69acf7962910
Diffstat (limited to 'context.cpp')
-rw-r--r--context.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/context.cpp b/context.cpp
index b55467a..87b6c3f 100644
--- a/context.cpp
+++ b/context.cpp
@@ -615,6 +615,24 @@ bool Context::sign(QStringList *uidList, const QByteArray &inBuffer, QByteArray
return (err == GPG_ERR_NO_ERROR);
}
+
+/*
+ * if there is no '\n' before the PGP-Begin-Block, but for example a whitespace,
+ * GPGME doesn't recognise the Message as encrypted. This function adds '\n'
+ * before the PGP-Begin-Block, if missing.
+ */
+void Context::preventNoDataErr(QByteArray *in)
+{
+ int block_start = in->indexOf("-----BEGIN PGP MESSAGE-----");
+ if (block_start > 0 && in->at(block_start - 1) != '\n') {
+ in->insert(block_start, '\n');
+ }
+ block_start = in->indexOf("-----BEGIN PGP SIGNED MESSAGE-----");
+ if (block_start > 0 && in->at(block_start - 1) != '\n') {
+ in->insert(block_start, '\n');
+ }
+}
+
}