Messagelib

dkiminfo.h
1 /*
2  SPDX-FileCopyrightText: 2018-2021 Laurent Montel <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "messageviewer_export.h"
10 #include <QObject>
11 #include <QString>
12 #include <QStringList>
13 namespace MessageViewer
14 {
15 /**
16  * @brief The DKIMInfo class
17  * @author Laurent Montel <[email protected]>
18  */
19 class MESSAGEVIEWER_EXPORT DKIMInfo
20 {
21  Q_GADGET
22 public:
23  DKIMInfo();
24 
25  enum CanonicalizationType {
26  Unknown,
27  Simple,
28  Relaxed,
29  };
30  enum class HashingAlgorithmType {
31  Any,
32  Sha1,
33  Sha256,
34  Unknown,
35  };
36  Q_ENUM(HashingAlgorithmType)
37 
38  Q_REQUIRED_RESULT bool parseDKIM(const QString &header);
39 
40  Q_REQUIRED_RESULT int version() const;
41  void setVersion(int version);
42 
43  Q_REQUIRED_RESULT HashingAlgorithmType hashingAlgorithm() const;
44  void setHashingAlgorithm(DKIMInfo::HashingAlgorithmType type);
45 
46  Q_REQUIRED_RESULT QString domain() const;
47  void setDomain(const QString &domain);
48 
49  Q_REQUIRED_RESULT QString selector() const;
50  void setSelector(const QString &selector);
51 
52  Q_REQUIRED_RESULT QString bodyHash() const;
53  void setBodyHash(const QString &bodyHash);
54 
55  Q_REQUIRED_RESULT bool isValid() const;
56 
57  Q_REQUIRED_RESULT QStringList listSignedHeader() const;
58  void setListSignedHeader(const QStringList &listSignedHeader);
59 
60  Q_REQUIRED_RESULT QString signingAlgorithm() const;
61  void setSigningAlgorithm(const QString &signingAlgorithm);
62 
63  Q_REQUIRED_RESULT qint64 signatureTimeStamp() const;
64  void setSignatureTimeStamp(qint64 signatureTimeStamp);
65 
66  Q_REQUIRED_RESULT QString query() const;
67  void setQuery(const QString &query);
68 
69  Q_REQUIRED_RESULT qint64 expireTime() const;
70  void setExpireTime(qint64 expireTime);
71 
72  Q_REQUIRED_RESULT QString signature() const;
73  void setSignature(const QString &signature);
74 
75  Q_REQUIRED_RESULT QString agentOrUserIdentifier() const;
76  void setAgentOrUserIdentifier(const QString &agentOrUserIdentifier);
77 
78  Q_REQUIRED_RESULT int bodyLengthCount() const;
79  void setBodyLengthCount(int bodyLengthCount);
80 
81  Q_REQUIRED_RESULT CanonicalizationType headerCanonization() const;
82  void setHeaderCanonization(CanonicalizationType headerCanonization);
83 
84  Q_REQUIRED_RESULT CanonicalizationType bodyCanonization() const;
85  void setBodyCanonization(CanonicalizationType bodyCanonization);
86 
87  Q_REQUIRED_RESULT bool operator==(const DKIMInfo &other) const;
88 
89  Q_REQUIRED_RESULT QStringList copiedHeaderField() const;
90  void setCopiedHeaderField(const QStringList &copiedHeaderField);
91 
92  Q_REQUIRED_RESULT QString iDomain() const;
93  void setIDomain(const QString &iDomain);
94 
95 private:
96  void parseCanonicalization(const QString &str);
97  void parseAlgorithm(const QString &str);
98  HashingAlgorithmType mHashingAlgorithm = HashingAlgorithmType::Any;
99  QString mSigningAlgorithm;
100  QString mDomain;
101  QString mSelector;
102  QString mBodyHash;
103  QString mQuery;
104  QString mSignature;
105  QString mAgentOrUserIdentifier;
106  QString mIDomain;
107  QStringList mListSignedHeader;
108  QStringList mCopiedHeaderField; // Default is empty
109  qint64 mSignatureTimeStamp = -1;
110  qint64 mExpireTime = -1;
111  int mVersion = -1;
112  int mBodyLengthCount = -1;
113  CanonicalizationType mHeaderCanonization = Unknown;
114  CanonicalizationType mBodyCanonization = Unknown;
115 };
116 }
117 Q_DECLARE_METATYPE(MessageViewer::DKIMInfo)
118 MESSAGEVIEWER_EXPORT QDebug operator<<(QDebug d, const MessageViewer::DKIMInfo &t);
PartitionTable::TableType type
QDataStream & operator<<(QDataStream &out, const KDateTime::Spec &spec)
The DKIMInfo class.
Definition: dkiminfo.h:19
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Nov 30 2021 23:05:46 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.