aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gpg4usb.pro6
-rw-r--r--gpgcontext.cpp8
-rw-r--r--gpgcontext.h1
3 files changed, 9 insertions, 6 deletions
diff --git a/gpg4usb.pro b/gpg4usb.pro
index 772dda1..dec67fc 100644
--- a/gpg4usb.pro
+++ b/gpg4usb.pro
@@ -36,7 +36,8 @@ HEADERS += attachments.h \
verifydetailsdialog.h \
verifykeydetailbox.h \
wizard.h \
- helppage.h
+ helppage.h \
+ gpgconstants.h
SOURCES += attachments.cpp \
gpgcontext.cpp \
@@ -60,7 +61,8 @@ SOURCES += attachments.cpp \
verifydetailsdialog.cpp \
verifykeydetailbox.cpp \
wizard.cpp \
- helppage.cpp
+ helppage.cpp \
+ gpgconstants.cpp
RC_FILE = gpg4usb.rc
diff --git a/gpgcontext.cpp b/gpgcontext.cpp
index 46edbe8..c632266 100644
--- a/gpgcontext.cpp
+++ b/gpgcontext.cpp
@@ -637,11 +637,11 @@ bool GpgContext::sign(QStringList *uidList, const QByteArray &inBuffer, QByteArr
*/
void GpgContext::preventNoDataErr(QByteArray *in)
{
- int block_start = in->indexOf("-----BEGIN PGP MESSAGE-----");
+ int block_start = in->indexOf(GpgConstants::PGP_CRYPT_BEGIN);
if (block_start > 0 && in->at(block_start - 1) != '\n') {
in->insert(block_start, '\n');
}
- block_start = in->indexOf("-----BEGIN PGP SIGNED MESSAGE-----");
+ block_start = in->indexOf(GpgConstants::PGP_SIGNED_BEGIN);
if (block_start > 0 && in->at(block_start - 1) != '\n') {
in->insert(block_start, '\n');
}
@@ -654,10 +654,10 @@ void GpgContext::preventNoDataErr(QByteArray *in)
* - 2, if text is completly signed
*/
int GpgContext::textIsSigned(const QByteArray &text) {
- if (text.trimmed().startsWith("-----BEGIN PGP SIGNED MESSAGE-----") && text.trimmed().endsWith("-----END PGP SIGNATURE-----")) {
+ if (text.trimmed().startsWith(GpgConstants::PGP_SIGNED_BEGIN) && text.trimmed().endsWith(GpgConstants::PGP_SIGNED_END)) {
return 2;
}
- if (text.contains("-----BEGIN PGP SIGNED MESSAGE-----") && text.contains("-----END PGP SIGNATURE-----")) {
+ if (text.contains(GpgConstants::PGP_SIGNED_BEGIN) && text.contains(GpgConstants::PGP_SIGNED_END)) {
return 1;
}
return 0;
diff --git a/gpgcontext.h b/gpgcontext.h
index be43764..f754418 100644
--- a/gpgcontext.h
+++ b/gpgcontext.h
@@ -22,6 +22,7 @@
#ifndef __SGPGMEPP_CONTEXT_H__
#define __SGPGMEPP_CONTEXT_H__
+#include "gpgconstants.h"
#include <locale.h>
#include <errno.h>
#include <gpgme.h>