Messagelib

cryptohelper.h
1 /*
2  cryptohelper.h
3 
4  SPDX-FileCopyrightText: 2015 Sandro Knauß <[email protected]>
5  SPDX-FileCopyrightText: 2001,2002 the KPGP authors
6  See file AUTHORS.kpgp for details
7 
8  SPDX-License-Identifier: GPL-2.0-or-later
9  */
10 
11 #pragma once
12 
13 #include <QByteArray>
14 #include <QVector>
15 
16 namespace MimeTreeParser
17 {
18 enum PGPBlockType {
19  UnknownBlock = -1, // BEGIN PGP ???
20  NoPgpBlock = 0,
21  PgpMessageBlock = 1, // BEGIN PGP MESSAGE
22  MultiPgpMessageBlock = 2, // BEGIN PGP MESSAGE, PART X[/Y]
23  SignatureBlock = 3, // BEGIN PGP SIGNATURE
24  ClearsignedBlock = 4, // BEGIN PGP SIGNED MESSAGE
25  PublicKeyBlock = 5, // BEGIN PGP PUBLIC KEY BLOCK
26  PrivateKeyBlock = 6, // BEGIN PGP PRIVATE KEY BLOCK (PGP 2.x: ...SECRET...)
27 };
28 
29 class Block
30 {
31 public:
32  Block();
33  Block(const QByteArray &m);
34 
35  Block(const QByteArray &m, PGPBlockType t);
36 
37  Q_REQUIRED_RESULT QByteArray text() const;
38  Q_REQUIRED_RESULT PGPBlockType type() const;
39  Q_REQUIRED_RESULT PGPBlockType determineType() const;
40 
41  QByteArray msg;
42  PGPBlockType mType = UnknownBlock;
43 };
44 
45 /** Parses the given message and splits it into OpenPGP blocks and
46  Non-OpenPGP blocks.
47 */
48 Q_REQUIRED_RESULT QVector<Block> prepareMessageForDecryption(const QByteArray &msg);
49 } // namespace MimeTreeParser
50 
51 Q_DECLARE_TYPEINFO(MimeTreeParser::Block, Q_MOVABLE_TYPE);
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Mar 26 2023 04:08:10 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.