summaryrefslogtreecommitdiffstats
path: root/framework/src/domain/mime/mimetreeparser/cryptohelper.h
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/domain/mime/mimetreeparser/cryptohelper.h')
-rw-r--r--framework/src/domain/mime/mimetreeparser/cryptohelper.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/framework/src/domain/mime/mimetreeparser/cryptohelper.h b/framework/src/domain/mime/mimetreeparser/cryptohelper.h
new file mode 100644
index 00000000..f09771c3
--- /dev/null
+++ b/framework/src/domain/mime/mimetreeparser/cryptohelper.h
@@ -0,0 +1,62 @@
1/*
2 cryptohelper.h
3
4 Copyright (C) 2015 Sandro Knauß <knauss@kolabsys.com>
5 Copyright (C) 2001,2002 the KPGP authors
6 See file AUTHORS.kpgp for details
7
8 KMail is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software Foundation,
15 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
16 */
17
18#ifndef __MIMETREEPARSER_CRYPTOHELPER_H__
19#define __MIMETREEPARSER_CRYPTOHELPER_H__
20
21#include <QByteArray>
22#include <QList>
23
24namespace MimeTreeParser
25{
26
27enum PGPBlockType {
28 UnknownBlock = -1, // BEGIN PGP ???
29 NoPgpBlock = 0,
30 PgpMessageBlock = 1, // BEGIN PGP MESSAGE
31 MultiPgpMessageBlock = 2, // BEGIN PGP MESSAGE, PART X[/Y]
32 SignatureBlock = 3, // BEGIN PGP SIGNATURE
33 ClearsignedBlock = 4, // BEGIN PGP SIGNED MESSAGE
34 PublicKeyBlock = 5, // BEGIN PGP PUBLIC KEY BLOCK
35 PrivateKeyBlock = 6 // BEGIN PGP PRIVATE KEY BLOCK (PGP 2.x: ...SECRET...)
36};
37
38class Block
39{
40public:
41 Block(const QByteArray &m);
42
43 Block(const QByteArray &m, PGPBlockType t);
44
45 QByteArray text() const;
46 PGPBlockType type() const;
47 PGPBlockType determineType() const;
48
49 QByteArray msg;
50 PGPBlockType mType;
51};
52
53/** Parses the given message and splits it into OpenPGP blocks and
54 Non-OpenPGP blocks.
55*/
56QList<Block> prepareMessageForDecryption(const QByteArray &msg);
57
58} // namespace MimeTreeParser
59
60Q_DECLARE_TYPEINFO(MimeTreeParser::Block, Q_MOVABLE_TYPE);
61
62#endif