diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-04-26 21:20:46 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-04-26 21:20:46 +0200 |
commit | 5da025fb7d42e4c82d7f3c3a7460e2ac1b8698d0 (patch) | |
tree | f1a17aac193206f6d95baba73068de9348cf6ccd | |
parent | ae20f0a057f4740e3eedb1641d99c37601ad0b7f (diff) | |
download | kube-5da025fb7d42e4c82d7f3c3a7460e2ac1b8698d0.tar.gz kube-5da025fb7d42e4c82d7f3c3a7460e2ac1b8698d0.zip |
Less gpgme in the interfaces
8 files changed, 88 insertions, 69 deletions
diff --git a/framework/src/domain/mime/mimetreeparser/applicationpgpencrypted.cpp b/framework/src/domain/mime/mimetreeparser/applicationpgpencrypted.cpp index 122a7577..a912c9c9 100644 --- a/framework/src/domain/mime/mimetreeparser/applicationpgpencrypted.cpp +++ b/framework/src/domain/mime/mimetreeparser/applicationpgpencrypted.cpp | |||
@@ -59,7 +59,7 @@ MessagePart::Ptr ApplicationPGPEncryptedBodyPartFormatter::process(Interface::Bo | |||
59 | } | 59 | } |
60 | 60 | ||
61 | EncryptedMessagePart::Ptr mp(new EncryptedMessagePart(part.objectTreeParser(), | 61 | EncryptedMessagePart::Ptr mp(new EncryptedMessagePart(part.objectTreeParser(), |
62 | data->decodedText(), GpgME::OpenPGP, | 62 | data->decodedText(), OpenPGP, |
63 | part.nodeHelper()->fromAsString(data), node, data)); | 63 | part.nodeHelper()->fromAsString(data), node, data)); |
64 | mp->setIsEncrypted(true); | 64 | mp->setIsEncrypted(true); |
65 | return mp; | 65 | return mp; |
diff --git a/framework/src/domain/mime/mimetreeparser/applicationpkcs7mime.cpp b/framework/src/domain/mime/mimetreeparser/applicationpkcs7mime.cpp index f65aa938..4780439b 100644 --- a/framework/src/domain/mime/mimetreeparser/applicationpkcs7mime.cpp +++ b/framework/src/domain/mime/mimetreeparser/applicationpkcs7mime.cpp | |||
@@ -24,8 +24,6 @@ | |||
24 | #include "objecttreeparser.h" | 24 | #include "objecttreeparser.h" |
25 | #include "messagepart.h" | 25 | #include "messagepart.h" |
26 | 26 | ||
27 | #include <QGpgME/Protocol> | ||
28 | |||
29 | #include <KMime/Content> | 27 | #include <KMime/Content> |
30 | 28 | ||
31 | #include <QTextCodec> | 29 | #include <QTextCodec> |
@@ -56,7 +54,7 @@ MessagePart::Ptr ApplicationPkcs7MimeBodyPartFormatter::process(Interface::BodyP | |||
56 | const QString smimeType = node->contentType()->parameter(QStringLiteral("smime-type")).toLower(); | 54 | const QString smimeType = node->contentType()->parameter(QStringLiteral("smime-type")).toLower(); |
57 | 55 | ||
58 | if (smimeType == QLatin1String("certs-only")) { | 56 | if (smimeType == QLatin1String("certs-only")) { |
59 | return CertMessagePart::Ptr(new CertMessagePart(part.objectTreeParser(), node, GpgME::CMS)); | 57 | return CertMessagePart::Ptr(new CertMessagePart(part.objectTreeParser(), node, CMS)); |
60 | } | 58 | } |
61 | 59 | ||
62 | bool isSigned = (smimeType == QLatin1String("signed-data")); | 60 | bool isSigned = (smimeType == QLatin1String("signed-data")); |
@@ -79,7 +77,7 @@ MessagePart::Ptr ApplicationPkcs7MimeBodyPartFormatter::process(Interface::BodyP | |||
79 | } | 77 | } |
80 | 78 | ||
81 | auto _mp = EncryptedMessagePart::Ptr(new EncryptedMessagePart(part.objectTreeParser(), | 79 | auto _mp = EncryptedMessagePart::Ptr(new EncryptedMessagePart(part.objectTreeParser(), |
82 | node->decodedText(), GpgME::CMS, | 80 | node->decodedText(), CMS, |
83 | part.nodeHelper()->fromAsString(node), node)); | 81 | part.nodeHelper()->fromAsString(node), node)); |
84 | mp = _mp; | 82 | mp = _mp; |
85 | _mp->setIsEncrypted(true); | 83 | _mp->setIsEncrypted(true); |
@@ -125,7 +123,7 @@ MessagePart::Ptr ApplicationPkcs7MimeBodyPartFormatter::process(Interface::BodyP | |||
125 | const QTextCodec *aCodec(part.objectTreeParser()->codecFor(signTestNode)); | 123 | const QTextCodec *aCodec(part.objectTreeParser()->codecFor(signTestNode)); |
126 | const QByteArray signaturetext = signTestNode->decodedContent(); | 124 | const QByteArray signaturetext = signTestNode->decodedContent(); |
127 | auto mp = SignedMessagePart::Ptr(new SignedMessagePart(part.objectTreeParser(), | 125 | auto mp = SignedMessagePart::Ptr(new SignedMessagePart(part.objectTreeParser(), |
128 | aCodec->toUnicode(signaturetext), GpgME::CMS, | 126 | aCodec->toUnicode(signaturetext), CMS, |
129 | part.nodeHelper()->fromAsString(node), signTestNode, signTestNode)); | 127 | part.nodeHelper()->fromAsString(node), signTestNode, signTestNode)); |
130 | } | 128 | } |
131 | return mp; | 129 | return mp; |
diff --git a/framework/src/domain/mime/mimetreeparser/messagepart.cpp b/framework/src/domain/mime/mimetreeparser/messagepart.cpp index f4a962f7..9750ea9e 100644 --- a/framework/src/domain/mime/mimetreeparser/messagepart.cpp +++ b/framework/src/domain/mime/mimetreeparser/messagepart.cpp | |||
@@ -47,24 +47,38 @@ static GpgME::Data fromBA(const QByteArray &ba) | |||
47 | return {ba.data(), static_cast<size_t>(ba.size()), false}; | 47 | return {ba.data(), static_cast<size_t>(ba.size()), false}; |
48 | } | 48 | } |
49 | 49 | ||
50 | static QSharedPointer<GpgME::Context> gpgContext(GpgME::Protocol protocol) | 50 | |
51 | static GpgME::Protocol toGpgMe(CryptoProtocol p) | ||
52 | { | ||
53 | switch (p) { | ||
54 | case UnknownProtocol: | ||
55 | return GpgME::UnknownProtocol; | ||
56 | case CMS: | ||
57 | return GpgME::CMS; | ||
58 | case OpenPGP: | ||
59 | return GpgME::OpenPGP; | ||
60 | } | ||
61 | return GpgME::UnknownProtocol; | ||
62 | } | ||
63 | |||
64 | static QSharedPointer<GpgME::Context> gpgContext(CryptoProtocol protocol) | ||
51 | { | 65 | { |
52 | GpgME::initializeLibrary(); | 66 | GpgME::initializeLibrary(); |
53 | auto error = GpgME::checkEngine(protocol); | 67 | auto error = GpgME::checkEngine(toGpgMe(protocol)); |
54 | if (error) { | 68 | if (error) { |
55 | qWarning() << "Engine check failed: " << error.asString(); | 69 | qWarning() << "Engine check failed: " << error.asString(); |
56 | } | 70 | } |
57 | auto ctx = QSharedPointer<GpgME::Context>(GpgME::Context::createForProtocol(protocol)); | 71 | auto ctx = QSharedPointer<GpgME::Context>(GpgME::Context::createForProtocol(toGpgMe(protocol))); |
58 | Q_ASSERT(ctx); | 72 | Q_ASSERT(ctx); |
59 | return ctx; | 73 | return ctx; |
60 | } | 74 | } |
61 | 75 | ||
62 | static GpgME::VerificationResult verifyDetachedSignature(GpgME::Protocol protocol, const QByteArray &signature, const QByteArray &text) | 76 | static GpgME::VerificationResult verifyDetachedSignature(CryptoProtocol protocol, const QByteArray &signature, const QByteArray &text) |
63 | { | 77 | { |
64 | return gpgContext(protocol)->verifyDetachedSignature(fromBA(signature), fromBA(text)); | 78 | return gpgContext(protocol)->verifyDetachedSignature(fromBA(signature), fromBA(text)); |
65 | } | 79 | } |
66 | 80 | ||
67 | static GpgME::VerificationResult verifyOpaqueSignature(GpgME::Protocol protocol, const QByteArray &signature, QByteArray &outdata) | 81 | static GpgME::VerificationResult verifyOpaqueSignature(CryptoProtocol protocol, const QByteArray &signature, QByteArray &outdata) |
68 | { | 82 | { |
69 | QGpgME::QByteArrayDataProvider out; | 83 | QGpgME::QByteArrayDataProvider out; |
70 | GpgME::Data wrapper(&out); | 84 | GpgME::Data wrapper(&out); |
@@ -74,7 +88,7 @@ static GpgME::VerificationResult verifyOpaqueSignature(GpgME::Protocol protocol, | |||
74 | } | 88 | } |
75 | 89 | ||
76 | 90 | ||
77 | static std::pair<GpgME::DecryptionResult,GpgME::VerificationResult> decryptAndVerify(GpgME::Protocol protocol, const QByteArray &ciphertext, QByteArray &outdata) | 91 | static std::pair<GpgME::DecryptionResult,GpgME::VerificationResult> decryptAndVerify(CryptoProtocol protocol, const QByteArray &ciphertext, QByteArray &outdata) |
78 | { | 92 | { |
79 | QGpgME::QByteArrayDataProvider out; | 93 | QGpgME::QByteArrayDataProvider out; |
80 | GpgME::Data wrapper(&out); | 94 | GpgME::Data wrapper(&out); |
@@ -83,12 +97,12 @@ static std::pair<GpgME::DecryptionResult,GpgME::VerificationResult> decryptAndVe | |||
83 | return res; | 97 | return res; |
84 | } | 98 | } |
85 | 99 | ||
86 | static void importKeys(GpgME::Protocol protocol, const QByteArray &certData) | 100 | static void importKeys(CryptoProtocol protocol, const QByteArray &certData) |
87 | { | 101 | { |
88 | gpgContext(protocol)->importKeys(fromBA(certData)); | 102 | gpgContext(protocol)->importKeys(fromBA(certData)); |
89 | } | 103 | } |
90 | 104 | ||
91 | static GpgME::KeyListResult listKeys(GpgME::Protocol protocol, const char *pattern, bool secretOnly, std::vector<GpgME::Key> &keys) { | 105 | static GpgME::KeyListResult listKeys(CryptoProtocol protocol, const char *pattern, bool secretOnly, std::vector<GpgME::Key> &keys) { |
92 | auto ctx = gpgContext(protocol); | 106 | auto ctx = gpgContext(protocol); |
93 | if (const GpgME::Error err = ctx->startKeyListing(pattern, secretOnly)) { | 107 | if (const GpgME::Error err = ctx->startKeyListing(pattern, secretOnly)) { |
94 | return GpgME::KeyListResult( 0, err ); | 108 | return GpgME::KeyListResult( 0, err ); |
@@ -464,7 +478,7 @@ void TextMessagePart::parseContent() | |||
464 | auto body = mNode->decodedContent(); | 478 | auto body = mNode->decodedContent(); |
465 | const auto blocks = prepareMessageForDecryption(body); | 479 | const auto blocks = prepareMessageForDecryption(body); |
466 | 480 | ||
467 | const auto cryptProto = GpgME::OpenPGP; | 481 | const auto cryptProto = OpenPGP; |
468 | 482 | ||
469 | if (!blocks.isEmpty()) { | 483 | if (!blocks.isEmpty()) { |
470 | 484 | ||
@@ -715,7 +729,7 @@ QString AlternativeMessagePart::htmlContent() const | |||
715 | 729 | ||
716 | //-----CertMessageBlock---------------------- | 730 | //-----CertMessageBlock---------------------- |
717 | 731 | ||
718 | CertMessagePart::CertMessagePart(ObjectTreeParser *otp, KMime::Content *node, const GpgME::Protocol cryptoProto) | 732 | CertMessagePart::CertMessagePart(ObjectTreeParser *otp, KMime::Content *node, const CryptoProtocol cryptoProto) |
719 | : MessagePart(otp, QString(), node) | 733 | : MessagePart(otp, QString(), node) |
720 | , mProtocol(cryptoProto) | 734 | , mProtocol(cryptoProto) |
721 | { | 735 | { |
@@ -744,7 +758,7 @@ QString CertMessagePart::text() const | |||
744 | //-----SignedMessageBlock--------------------- | 758 | //-----SignedMessageBlock--------------------- |
745 | SignedMessagePart::SignedMessagePart(ObjectTreeParser *otp, | 759 | SignedMessagePart::SignedMessagePart(ObjectTreeParser *otp, |
746 | const QString &text, | 760 | const QString &text, |
747 | const GpgME::Protocol cryptoProto, | 761 | const CryptoProtocol cryptoProto, |
748 | const QString &fromAddress, | 762 | const QString &fromAddress, |
749 | KMime::Content *node, KMime::Content *signedData) | 763 | KMime::Content *node, KMime::Content *signedData) |
750 | : MessagePart(otp, text, node) | 764 | : MessagePart(otp, text, node) |
@@ -754,7 +768,8 @@ SignedMessagePart::SignedMessagePart(ObjectTreeParser *otp, | |||
754 | { | 768 | { |
755 | mMetaData.isSigned = true; | 769 | mMetaData.isSigned = true; |
756 | mMetaData.isGoodSignature = false; | 770 | mMetaData.isGoodSignature = false; |
757 | mMetaData.keyTrust = GpgME::Signature::Unknown; | 771 | //FIXME |
772 | // mMetaData.keyTrust = GpgME::Signature::Unknown; | ||
758 | mMetaData.status = tr("Wrong Crypto Plug-In."); | 773 | mMetaData.status = tr("Wrong Crypto Plug-In."); |
759 | mMetaData.status_code = GPGME_SIG_STAT_NONE; | 774 | mMetaData.status_code = GPGME_SIG_STAT_NONE; |
760 | } | 775 | } |
@@ -805,7 +820,13 @@ void SignedMessagePart::sigStatusToMetaData(const GpgME::Signature &signature) | |||
805 | mMetaData.status_code = signatureToStatus(signature); | 820 | mMetaData.status_code = signatureToStatus(signature); |
806 | mMetaData.isGoodSignature = mMetaData.status_code & GPGME_SIG_STAT_GOOD; | 821 | mMetaData.isGoodSignature = mMetaData.status_code & GPGME_SIG_STAT_GOOD; |
807 | // save extended signature status flags | 822 | // save extended signature status flags |
808 | mMetaData.sigSummary = signature.summary(); | 823 | auto summary = signature.summary(); |
824 | mMetaData.keyMissing = summary & GpgME::Signature::KeyMissing; | ||
825 | mMetaData.keyExpired = summary & GpgME::Signature::KeyExpired; | ||
826 | mMetaData.keyRevoked = summary & GpgME::Signature::KeyRevoked; | ||
827 | mMetaData.sigExpired = summary & GpgME::Signature::SigExpired; | ||
828 | mMetaData.crlMissing = summary & GpgME::Signature::CrlMissing; | ||
829 | mMetaData.crlTooOld = summary & GpgME::Signature::CrlTooOld; | ||
809 | 830 | ||
810 | if (mMetaData.isGoodSignature && !key.keyID()) { | 831 | if (mMetaData.isGoodSignature && !key.keyID()) { |
811 | // Search for the key by its fingerprint so that we can check for trust etc. | 832 | // Search for the key by its fingerprint so that we can check for trust etc. |
@@ -832,7 +853,8 @@ void SignedMessagePart::sigStatusToMetaData(const GpgME::Signature &signature) | |||
832 | if (mMetaData.keyId.isEmpty()) { | 853 | if (mMetaData.keyId.isEmpty()) { |
833 | mMetaData.keyId = signature.fingerprint(); | 854 | mMetaData.keyId = signature.fingerprint(); |
834 | } | 855 | } |
835 | mMetaData.keyTrust = signature.validity(); | 856 | auto keyTrust = signature.validity(); |
857 | mMetaData.keyIsTrusted = keyTrust & GpgME::Signature::Full || keyTrust & GpgME::Signature::Ultimate; | ||
836 | if (key.numUserIDs() > 0 && key.userID(0).id()) { | 858 | if (key.numUserIDs() > 0 && key.userID(0).id()) { |
837 | mMetaData.signer = prettifyDN(key.userID(0).id()); | 859 | mMetaData.signer = prettifyDN(key.userID(0).id()); |
838 | } | 860 | } |
@@ -899,7 +921,8 @@ void SignedMessagePart::startVerificationDetached(const QByteArray &text, KMime: | |||
899 | } | 921 | } |
900 | 922 | ||
901 | mMetaData.isSigned = false; | 923 | mMetaData.isSigned = false; |
902 | mMetaData.keyTrust = GpgME::Signature::Unknown; | 924 | //FIXME |
925 | // mMetaData.keyTrust = GpgME::Signature::Unknown; | ||
903 | mMetaData.status = tr("Wrong Crypto Plug-In."); | 926 | mMetaData.status = tr("Wrong Crypto Plug-In."); |
904 | mMetaData.status_code = GPGME_SIG_STAT_NONE; | 927 | mMetaData.status_code = GPGME_SIG_STAT_NONE; |
905 | 928 | ||
@@ -920,7 +943,8 @@ void SignedMessagePart::startVerificationDetached(const QByteArray &text, KMime: | |||
920 | void SignedMessagePart::setVerificationResult(const GpgME::VerificationResult &result, bool parseText, const QByteArray &plainText) | 943 | void SignedMessagePart::setVerificationResult(const GpgME::VerificationResult &result, bool parseText, const QByteArray &plainText) |
921 | { | 944 | { |
922 | auto signatures = result.signatures(); | 945 | auto signatures = result.signatures(); |
923 | mMetaData.auditLogError = result.error(); | 946 | // FIXME |
947 | // mMetaData.auditLogError = result.error(); | ||
924 | if (!signatures.empty()) { | 948 | if (!signatures.empty()) { |
925 | mMetaData.isSigned = true; | 949 | mMetaData.isSigned = true; |
926 | sigStatusToMetaData(signatures.front()); | 950 | sigStatusToMetaData(signatures.front()); |
@@ -955,7 +979,7 @@ QString SignedMessagePart::htmlContent() const | |||
955 | //-----CryptMessageBlock--------------------- | 979 | //-----CryptMessageBlock--------------------- |
956 | EncryptedMessagePart::EncryptedMessagePart(ObjectTreeParser *otp, | 980 | EncryptedMessagePart::EncryptedMessagePart(ObjectTreeParser *otp, |
957 | const QString &text, | 981 | const QString &text, |
958 | const GpgME::Protocol cryptoProto, | 982 | const CryptoProtocol cryptoProto, |
959 | const QString &fromAddress, | 983 | const QString &fromAddress, |
960 | KMime::Content *node, KMime::Content *encryptedNode) | 984 | KMime::Content *node, KMime::Content *encryptedNode) |
961 | : MessagePart(otp, text, node) | 985 | : MessagePart(otp, text, node) |
@@ -967,7 +991,8 @@ EncryptedMessagePart::EncryptedMessagePart(ObjectTreeParser *otp, | |||
967 | mMetaData.isGoodSignature = false; | 991 | mMetaData.isGoodSignature = false; |
968 | mMetaData.isEncrypted = false; | 992 | mMetaData.isEncrypted = false; |
969 | mMetaData.isDecryptable = false; | 993 | mMetaData.isDecryptable = false; |
970 | mMetaData.keyTrust = GpgME::Signature::Unknown; | 994 | //FIXME |
995 | // mMetaData.keyTrust = GpgME::Signature::Unknown; | ||
971 | mMetaData.status = tr("Wrong Crypto Plug-In."); | 996 | mMetaData.status = tr("Wrong Crypto Plug-In."); |
972 | mMetaData.status_code = GPGME_SIG_STAT_NONE; | 997 | mMetaData.status_code = GPGME_SIG_STAT_NONE; |
973 | } | 998 | } |
@@ -1021,7 +1046,8 @@ bool EncryptedMessagePart::okDecryptMIME(KMime::Content &data) | |||
1021 | { | 1046 | { |
1022 | mError = NoError; | 1047 | mError = NoError; |
1023 | mMetaData.errorText.clear(); | 1048 | mMetaData.errorText.clear(); |
1024 | mMetaData.auditLogError = GpgME::Error(); | 1049 | //FIXME |
1050 | // mMetaData.auditLogError = GpgME::Error(); | ||
1025 | mMetaData.auditLog.clear(); | 1051 | mMetaData.auditLog.clear(); |
1026 | 1052 | ||
1027 | const QByteArray ciphertext = data.decodedContent(); | 1053 | const QByteArray ciphertext = data.decodedContent(); |
diff --git a/framework/src/domain/mime/mimetreeparser/messagepart.h b/framework/src/domain/mime/mimetreeparser/messagepart.h index b2714f09..31864ee5 100644 --- a/framework/src/domain/mime/mimetreeparser/messagepart.h +++ b/framework/src/domain/mime/mimetreeparser/messagepart.h | |||
@@ -57,6 +57,12 @@ class MultiPartAlternativeBodyPartFormatter; | |||
57 | class SignedMessagePart; | 57 | class SignedMessagePart; |
58 | class EncryptedMessagePart; | 58 | class EncryptedMessagePart; |
59 | 59 | ||
60 | enum CryptoProtocol { | ||
61 | UnknownProtocol, | ||
62 | OpenPGP, | ||
63 | CMS | ||
64 | }; | ||
65 | |||
60 | class MessagePart : public QObject | 66 | class MessagePart : public QObject |
61 | { | 67 | { |
62 | Q_OBJECT | 68 | Q_OBJECT |
@@ -262,14 +268,14 @@ class CertMessagePart : public MessagePart | |||
262 | Q_OBJECT | 268 | Q_OBJECT |
263 | public: | 269 | public: |
264 | typedef QSharedPointer<CertMessagePart> Ptr; | 270 | typedef QSharedPointer<CertMessagePart> Ptr; |
265 | CertMessagePart(MimeTreeParser::ObjectTreeParser *otp, KMime::Content *node, const GpgME::Protocol cryptoProto); | 271 | CertMessagePart(MimeTreeParser::ObjectTreeParser *otp, KMime::Content *node, const CryptoProtocol cryptoProto); |
266 | virtual ~CertMessagePart(); | 272 | virtual ~CertMessagePart(); |
267 | 273 | ||
268 | QString text() const Q_DECL_OVERRIDE; | 274 | QString text() const Q_DECL_OVERRIDE; |
269 | void import(); | 275 | void import(); |
270 | 276 | ||
271 | private: | 277 | private: |
272 | const GpgME::Protocol mProtocol; | 278 | const CryptoProtocol mProtocol; |
273 | friend class DefaultRendererPrivate; | 279 | friend class DefaultRendererPrivate; |
274 | }; | 280 | }; |
275 | 281 | ||
@@ -298,7 +304,7 @@ public: | |||
298 | typedef QSharedPointer<EncryptedMessagePart> Ptr; | 304 | typedef QSharedPointer<EncryptedMessagePart> Ptr; |
299 | EncryptedMessagePart(ObjectTreeParser *otp, | 305 | EncryptedMessagePart(ObjectTreeParser *otp, |
300 | const QString &text, | 306 | const QString &text, |
301 | const GpgME::Protocol protocol, | 307 | const CryptoProtocol protocol, |
302 | const QString &fromAddress, | 308 | const QString &fromAddress, |
303 | KMime::Content *node, KMime::Content *encryptedNode = nullptr); | 309 | KMime::Content *node, KMime::Content *encryptedNode = nullptr); |
304 | 310 | ||
@@ -327,7 +333,7 @@ private: | |||
327 | bool okDecryptMIME(KMime::Content &data); | 333 | bool okDecryptMIME(KMime::Content &data); |
328 | 334 | ||
329 | protected: | 335 | protected: |
330 | const GpgME::Protocol mProtocol; | 336 | const CryptoProtocol mProtocol; |
331 | QString mFromAddress; | 337 | QString mFromAddress; |
332 | QByteArray mVerifiedText; | 338 | QByteArray mVerifiedText; |
333 | std::vector<GpgME::DecryptionResult::Recipient> mDecryptRecipients; | 339 | std::vector<GpgME::DecryptionResult::Recipient> mDecryptRecipients; |
@@ -345,7 +351,7 @@ public: | |||
345 | typedef QSharedPointer<SignedMessagePart> Ptr; | 351 | typedef QSharedPointer<SignedMessagePart> Ptr; |
346 | SignedMessagePart(ObjectTreeParser *otp, | 352 | SignedMessagePart(ObjectTreeParser *otp, |
347 | const QString &text, | 353 | const QString &text, |
348 | const GpgME::Protocol protocol, | 354 | const CryptoProtocol protocol, |
349 | const QString &fromAddress, | 355 | const QString &fromAddress, |
350 | KMime::Content *node, KMime::Content *signedData); | 356 | KMime::Content *node, KMime::Content *signedData); |
351 | 357 | ||
@@ -367,7 +373,7 @@ private: | |||
367 | void setVerificationResult(const GpgME::VerificationResult &result, bool parseText, const QByteArray &plainText); | 373 | void setVerificationResult(const GpgME::VerificationResult &result, bool parseText, const QByteArray &plainText); |
368 | 374 | ||
369 | protected: | 375 | protected: |
370 | GpgME::Protocol mProtocol; | 376 | CryptoProtocol mProtocol; |
371 | QString mFromAddress; | 377 | QString mFromAddress; |
372 | KMime::Content *mSignedData; | 378 | KMime::Content *mSignedData; |
373 | 379 | ||
diff --git a/framework/src/domain/mime/mimetreeparser/multipartencrypted.cpp b/framework/src/domain/mime/mimetreeparser/multipartencrypted.cpp index 30fe4bc0..2e36366c 100644 --- a/framework/src/domain/mime/mimetreeparser/multipartencrypted.cpp +++ b/framework/src/domain/mime/mimetreeparser/multipartencrypted.cpp | |||
@@ -49,18 +49,18 @@ MessagePart::Ptr MultiPartEncryptedBodyPartFormatter::process(Interface::BodyPar | |||
49 | return MessagePart::Ptr(); | 49 | return MessagePart::Ptr(); |
50 | } | 50 | } |
51 | 51 | ||
52 | GpgME::Protocol useThisCryptProto = GpgME::UnknownProtocol; | 52 | CryptoProtocol useThisCryptProto = UnknownProtocol; |
53 | 53 | ||
54 | /* | 54 | /* |
55 | ATTENTION: This code is to be replaced by the new 'auto-detect' feature. -------------------------------------- | 55 | ATTENTION: This code is to be replaced by the new 'auto-detect' feature. -------------------------------------- |
56 | */ | 56 | */ |
57 | KMime::Content *data = findTypeInDirectChilds(node, "application/octet-stream"); | 57 | KMime::Content *data = findTypeInDirectChilds(node, "application/octet-stream"); |
58 | if (data) { | 58 | if (data) { |
59 | useThisCryptProto = GpgME::OpenPGP; | 59 | useThisCryptProto = OpenPGP; |
60 | } else { | 60 | } else { |
61 | data = findTypeInDirectChilds(node, "application/pkcs7-mime"); | 61 | data = findTypeInDirectChilds(node, "application/pkcs7-mime"); |
62 | if (data) { | 62 | if (data) { |
63 | useThisCryptProto = GpgME::CMS; | 63 | useThisCryptProto = CMS; |
64 | } | 64 | } |
65 | } | 65 | } |
66 | /* | 66 | /* |
diff --git a/framework/src/domain/mime/mimetreeparser/multipartsigned.cpp b/framework/src/domain/mime/mimetreeparser/multipartsigned.cpp index 5c00e7dc..b511afce 100644 --- a/framework/src/domain/mime/mimetreeparser/multipartsigned.cpp +++ b/framework/src/domain/mime/mimetreeparser/multipartsigned.cpp | |||
@@ -24,8 +24,6 @@ | |||
24 | 24 | ||
25 | #include <KMime/Content> | 25 | #include <KMime/Content> |
26 | 26 | ||
27 | #include <QGpgME/Protocol> | ||
28 | |||
29 | #include "mimetreeparser_debug.h" | 27 | #include "mimetreeparser_debug.h" |
30 | 28 | ||
31 | #include <QTextCodec> | 29 | #include <QTextCodec> |
@@ -67,16 +65,16 @@ MessagePart::Ptr MultiPartSignedBodyPartFormatter::process(Interface::BodyPart & | |||
67 | protocolContentType = signatureContentType; | 65 | protocolContentType = signatureContentType; |
68 | } | 66 | } |
69 | 67 | ||
70 | GpgME::Protocol protocol = GpgME::UnknownProtocol; | 68 | CryptoProtocol protocol = UnknownProtocol; |
71 | if (protocolContentType == QLatin1String("application/pkcs7-signature") || | 69 | if (protocolContentType == QLatin1String("application/pkcs7-signature") || |
72 | protocolContentType == QLatin1String("application/x-pkcs7-signature")) { | 70 | protocolContentType == QLatin1String("application/x-pkcs7-signature")) { |
73 | protocol = GpgME::CMS; | 71 | protocol = CMS; |
74 | } else if (protocolContentType == QLatin1String("application/pgp-signature") || | 72 | } else if (protocolContentType == QLatin1String("application/pgp-signature") || |
75 | protocolContentType == QLatin1String("application/x-pgp-signature")) { | 73 | protocolContentType == QLatin1String("application/x-pgp-signature")) { |
76 | protocol = GpgME::OpenPGP; | 74 | protocol = OpenPGP; |
77 | } | 75 | } |
78 | 76 | ||
79 | if (protocol == GpgME::UnknownProtocol) { | 77 | if (protocol == UnknownProtocol) { |
80 | return MessagePart::Ptr(new MimeMessagePart(part.objectTreeParser(), signedData, false)); | 78 | return MessagePart::Ptr(new MimeMessagePart(part.objectTreeParser(), signedData, false)); |
81 | } | 79 | } |
82 | 80 | ||
diff --git a/framework/src/domain/mime/mimetreeparser/partmetadata.h b/framework/src/domain/mime/mimetreeparser/partmetadata.h index 813ef4cb..44a9cf7e 100644 --- a/framework/src/domain/mime/mimetreeparser/partmetadata.h +++ b/framework/src/domain/mime/mimetreeparser/partmetadata.h | |||
@@ -16,8 +16,6 @@ | |||
16 | #ifndef __MIMETREEPARSER_PARTMETADATA_H__ | 16 | #ifndef __MIMETREEPARSER_PARTMETADATA_H__ |
17 | #define __MIMETREEPARSER_PARTMETADATA_H__ | 17 | #define __MIMETREEPARSER_PARTMETADATA_H__ |
18 | 18 | ||
19 | #include <gpgme++/verificationresult.h> | ||
20 | |||
21 | #include <QStringList> | 19 | #include <QStringList> |
22 | #include <QDateTime> | 20 | #include <QDateTime> |
23 | 21 | ||
@@ -27,35 +25,29 @@ namespace MimeTreeParser | |||
27 | class PartMetaData | 25 | class PartMetaData |
28 | { | 26 | { |
29 | public: | 27 | public: |
30 | PartMetaData() | 28 | bool keyMissing = false; |
31 | : sigSummary(GpgME::Signature::None), | 29 | bool keyExpired = false; |
32 | isSigned(false), | 30 | bool keyRevoked = false; |
33 | isGoodSignature(false), | 31 | bool sigExpired = false; |
34 | isEncrypted(false), | 32 | bool crlMissing = false; |
35 | isDecryptable(false), | 33 | bool crlTooOld = false; |
36 | technicalProblem(false), | ||
37 | isEncapsulatedRfc822Message(false) | ||
38 | { | ||
39 | } | ||
40 | GpgME::Signature::Summary sigSummary; | ||
41 | QString signClass; | 34 | QString signClass; |
42 | QString signer; | 35 | QString signer; |
43 | QStringList signerMailAddresses; | 36 | QStringList signerMailAddresses; |
44 | QByteArray keyId; | 37 | QByteArray keyId; |
45 | GpgME::Signature::Validity keyTrust; | 38 | bool keyIsTrusted = false; |
46 | QString status; // to be used for unknown plug-ins | 39 | QString status; // to be used for unknown plug-ins |
47 | int status_code; // to be used for i18n of OpenPGP and S/MIME CryptPlugs | 40 | int status_code; // to be used for i18n of OpenPGP and S/MIME CryptPlugs |
48 | QString errorText; | 41 | QString errorText; |
49 | QDateTime creationTime; | 42 | QDateTime creationTime; |
50 | QString decryptionError; | 43 | QString decryptionError; |
51 | QString auditLog; | 44 | QString auditLog; |
52 | GpgME::Error auditLogError; | 45 | bool isSigned = false; |
53 | bool isSigned : 1; | 46 | bool isGoodSignature =false; |
54 | bool isGoodSignature : 1; | 47 | bool isEncrypted = false; |
55 | bool isEncrypted : 1; | 48 | bool isDecryptable = false; |
56 | bool isDecryptable : 1; | 49 | bool technicalProblem = false; |
57 | bool technicalProblem : 1; | 50 | bool isEncapsulatedRfc822Message = false; |
58 | bool isEncapsulatedRfc822Message : 1; | ||
59 | }; | 51 | }; |
60 | 52 | ||
61 | } | 53 | } |
diff --git a/framework/src/domain/mime/partmodel.cpp b/framework/src/domain/mime/partmodel.cpp index 7b90ca8b..da2802c6 100644 --- a/framework/src/domain/mime/partmodel.cpp +++ b/framework/src/domain/mime/partmodel.cpp | |||
@@ -160,18 +160,17 @@ SignatureInfo *signatureInfo(MimeTreeParser::MessagePart *messagePart) | |||
160 | } | 160 | } |
161 | for (const auto &p : signatureParts) { | 161 | for (const auto &p : signatureParts) { |
162 | signatureInfo->keyId = p->partMetaData()->keyId; | 162 | signatureInfo->keyId = p->partMetaData()->keyId; |
163 | signatureInfo->keyMissing = p->partMetaData()->sigSummary & GpgME::Signature::KeyMissing; | 163 | signatureInfo->keyMissing = p->partMetaData()->keyMissing; |
164 | signatureInfo->keyExpired = p->partMetaData()->sigSummary & GpgME::Signature::KeyExpired; | 164 | signatureInfo->keyExpired = p->partMetaData()->keyExpired; |
165 | signatureInfo->keyRevoked = p->partMetaData()->sigSummary & GpgME::Signature::KeyRevoked; | 165 | signatureInfo->keyRevoked = p->partMetaData()->keyRevoked; |
166 | signatureInfo->sigExpired = p->partMetaData()->sigSummary & GpgME::Signature::SigExpired; | 166 | signatureInfo->sigExpired = p->partMetaData()->sigExpired; |
167 | signatureInfo->crlMissing = p->partMetaData()->sigSummary & GpgME::Signature::CrlMissing; | 167 | signatureInfo->crlMissing = p->partMetaData()->crlMissing; |
168 | signatureInfo->crlTooOld = p->partMetaData()->sigSummary & GpgME::Signature::CrlTooOld; | 168 | signatureInfo->crlTooOld = p->partMetaData()->crlTooOld; |
169 | signatureInfo->signer = p->partMetaData()->signer; | 169 | signatureInfo->signer = p->partMetaData()->signer; |
170 | signatureInfo->signClass = p->partMetaData()->signClass; | 170 | signatureInfo->signClass = p->partMetaData()->signClass; |
171 | signatureInfo->signerMailAddresses = p->partMetaData()->signerMailAddresses; | 171 | signatureInfo->signerMailAddresses = p->partMetaData()->signerMailAddresses; |
172 | signatureInfo->signatureIsGood = p->partMetaData()->isGoodSignature; | 172 | signatureInfo->signatureIsGood = p->partMetaData()->isGoodSignature; |
173 | signatureInfo->keyIsTrusted = p->partMetaData()->keyTrust & GpgME::Signature::Full || | 173 | signatureInfo->keyIsTrusted = p->partMetaData()->keyIsTrusted; |
174 | p->partMetaData()->keyTrust & GpgME::Signature::Ultimate; | ||
175 | } | 174 | } |
176 | return signatureInfo; | 175 | return signatureInfo; |
177 | } | 176 | } |