Messagelib

nearexpirychecker.h
1 /*
2  SPDX-FileCopyrightText: 2021 Sandro KnauƟ <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "messagecomposer_export.h"
10 
11 #include <gpgme++/key.h>
12 
13 #include <QObject>
14 
15 #include <memory>
16 
17 class NearExpiryCheckerTest;
18 
19 namespace MessageComposer
20 {
21 class NearExpiryCheckerPrivate;
22 
23 class MESSAGECOMPOSER_EXPORT NearExpiryChecker : public QObject
24 {
25  Q_OBJECT
26 public:
28  explicit NearExpiryChecker(int encrOwnKeyNearExpiryThresholdDays,
29  int encrKeyNearExpiryThresholdDays,
30  int encrRootCertNearExpNearExpiryCheckerPrivateiryThresholdDays,
31  int encrChainCertNearExpiryThresholdDays);
32 
33  ~NearExpiryChecker();
34 
35  Q_REQUIRED_RESULT int encryptOwnKeyNearExpiryWarningThresholdInDays() const;
36  Q_REQUIRED_RESULT int encryptKeyNearExpiryWarningThresholdInDays() const;
37  Q_REQUIRED_RESULT int encryptRootCertNearExpiryWarningThresholdInDays() const;
38  Q_REQUIRED_RESULT int encryptChainCertNearExpiryWarningThresholdInDays() const;
39 
40  enum ExpiryInformation { OwnKeyExpired, OwnKeyNearExpiry, OtherKeyExpired, OtherKeyNearExpiry };
41  Q_ENUM(ExpiryInformation)
42 
43  void checkOwnSigningKey(const GpgME::Key &key) const;
44  void checkOwnKey(const GpgME::Key &key) const;
45  void checkKey(const GpgME::Key &key) const;
46 
47 Q_SIGNALS:
48  void expiryMessage(const GpgME::Key &key, QString msg, MessageComposer::NearExpiryChecker::ExpiryInformation info, bool isNewMessage) const;
49 
50 private:
51  friend class ::NearExpiryCheckerTest;
52 
53  std::unique_ptr<NearExpiryCheckerPrivate> const d;
54 
55  Q_REQUIRED_RESULT MESSAGECOMPOSER_NO_EXPORT double calculateSecsTillExpiriy(const GpgME::Subkey &key) const;
56 
57  MESSAGECOMPOSER_NO_EXPORT void checkKeyNearExpiry(const GpgME::Key &key,
58  bool isOwnKey,
59  bool isSigningKey,
60  bool ca = false,
61  int recur_limit = 100,
62  const GpgME::Key &orig_key = GpgME::Key::null) const;
63 };
64 }
65 Q_DECLARE_METATYPE(GpgME::Key)
Simple interface that both EncryptJob and SignEncryptJob implement so the composer can extract some e...
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Apr 1 2023 04:01:57 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.