summaryrefslogtreecommitdiffstats
path: root/framework/src/domain/mime/mailcrypto.h
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2018-05-05 10:39:32 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-05-06 17:21:01 +0200
commit01594e68275a09c67b5ee258e2af86598118a6a0 (patch)
tree4f859815f6455906bb656f9cc27ba5d6e4111599 /framework/src/domain/mime/mailcrypto.h
parent481cb9f600caf3f45596bf78b5ba2bd07007969c (diff)
downloadkube-01594e68275a09c67b5ee258e2af86598118a6a0.tar.gz
kube-01594e68275a09c67b5ee258e2af86598118a6a0.zip
Port to gpgme only.
QGpgme and Gpgmepp are not readily available, the cmake files buggy, the buildsystem horrendous and generally just difficult to build on windows. Given that all they are is a wrapper around gpgme, we're better of without all the indirections. What we loose is: * QGpgme moved the work to separate threads (but we then blocked anyways), something that we can just do in our own code should we want to. * QGpgme has a function to prettify dn's that was used to show the signer. Also something we could bring back should we need to (don't know where it is useful atm.) Ported messagepart to gpgme Almost there Moved the crypto bits to a separate file All gpg code is in one place. All tests passing Use error codes Cleanup
Diffstat (limited to 'framework/src/domain/mime/mailcrypto.h')
-rw-r--r--framework/src/domain/mime/mailcrypto.h31
1 files changed, 4 insertions, 27 deletions
diff --git a/framework/src/domain/mime/mailcrypto.h b/framework/src/domain/mime/mailcrypto.h
index c9247859..6f19063d 100644
--- a/framework/src/domain/mime/mailcrypto.h
+++ b/framework/src/domain/mime/mailcrypto.h
@@ -22,42 +22,19 @@
22#include "framework/src/errors.h" 22#include "framework/src/errors.h"
23 23
24#include <KMime/Message> 24#include <KMime/Message>
25#include <gpgme++/key.h>
26 25
27#include <QByteArray> 26#include <QByteArray>
28#include <QVariant> 27#include <QVariant>
29 28
30#include <functional> 29#include <functional>
31#include <memory> 30#include <memory>
31#include "crypto.h"
32 32
33namespace MailCrypto { 33namespace MailCrypto {
34 34
35struct Key { 35Expected<Crypto::Error, std::unique_ptr<KMime::Content>>
36 GpgME::Key key; 36processCrypto(std::unique_ptr<KMime::Content> content, const std::vector<Crypto::Key> &signingKeys,
37}; 37 const std::vector<Crypto::Key> &encryptionKeys, const Crypto::Key &attachedKey);
38
39struct Error {
40 GpgME::Error key;
41};
42
43Expected<Error, std::unique_ptr<KMime::Content>>
44processCrypto(std::unique_ptr<KMime::Content> content, const std::vector<Key> &signingKeys,
45 const std::vector<Key> &encryptionKeys, const Key &attachedKey);
46
47std::vector<Key> findKeys(const QStringList &filter, bool findPrivate = false, bool remote = false);
48
49void importKeys(const std::vector<Key> &keys);
50
51struct ImportResult {
52 int considered;
53 int imported;
54 int unchanged;
55};
56
57ImportResult importKey(const QByteArray &key);
58 38
59}; // namespace MailCrypto 39}; // namespace MailCrypto
60 40
61Q_DECLARE_METATYPE(MailCrypto::Key);
62
63QDebug operator<< (QDebug d, const MailCrypto::Key &);