KNewStuff

security.h
1 /*
2  This file is part of KNewStuff2.
3  SPDX-FileCopyrightText: 2004, 2005 Andras Mantia <[email protected]>
4  SPDX-FileCopyrightText: 2007 Josef Spillner <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.1-or-later
7 */
8 
9 #ifndef KNEWSTUFF2_SECURITY_P_H
10 #define KNEWSTUFF2_SECURITY_P_H
11 
12 //qt includes
13 #include <QMap>
14 #include <QObject>
15 #include <QProcess>
16 
17 #include "knewstuffcore_export.h"
18 
19 #if KNEWSTUFFCORE_ENABLE_DEPRECATED_SINCE(5, 31)
20 
21 struct KeyStruct {
22  QString id;
23  QString name;
24  QString mail;
25  bool trusted;
26  bool secret;
27 };
28 
29 namespace KNSCore
30 {
31 
37 class KNEWSTUFFCORE_DEPRECATED_VERSION(5, 31, "No longer use")
38 KNEWSTUFFCORE_EXPORT Security : public QObject
39 {
40  Q_OBJECT
41 public:
42  static Security *ref()
43  {
44  static Security *m_ref;
45  if (!m_ref) {
46  m_ref = new Security();
47  }
48  return m_ref;
49  }
50  ~Security();
51 
57  void checkValidity(const QString &fileName);
58 
65  void signFile(const QString &fileName);
66 
73  KeyStruct signatureKey()
74  {
75  return m_signatureKey;
76  }
77 
78  enum Results {
79  MD5_OK = 1,
80  SIGNED_OK = 2,
81  SIGNED_BAD = 4,
82  TRUSTED = 8,
83  UNKNOWN = 16,
84  SIGNED_BAD_CLEAR = 27,
85  BAD_PASSPHRASE = 32
86  };
87 
88 public Q_SLOTS:
89 
91  void readKeys();
92 
94  void readSecretKeys();
95 
98  void slotCheckValidity();
99 
103  void slotSignFile();
104 
105 private:
106  Security();
107 
108  enum RunMode {
109  List = 0,
110  ListSecret,
111  Verify,
112  Sign
113  };
114 
115  KeyStruct m_signatureKey;
116  int m_result;
117  int m_runMode;
118  bool m_gpgRunning;
119  bool m_keysRead;
120  QMap<QString, KeyStruct> m_keys;
121  QString m_fileName;
122  QString m_secretKey;
123  QProcess *m_process;
124 
125 private Q_SLOTS:
126  void slotFinished(int exitCode, QProcess::ExitStatus exitStatus);
127  void slotReadyReadStandardOutput();
128 
129 Q_SIGNALS:
134  void validityResult(int result);
135 
140  void fileSigned(int result);
141 
142  void signalInformation(const QString &) const;
143  void signalError(const QString &) const;
144 };
145 
146 }
147 
148 #endif // KNEWSTUFFCORE_ENABLE_DEPRECATED_SINCE(5, 31)
149 
150 #endif
QAction * mail(const QObject *recvr, const char *slot, QObject *parent)
QString name(const QVariant &location)
Contains the core functionality for handling interaction with NewStuff providers. ...
Do not use this class.
Definition: security.h:37
KeyStruct signatureKey()
Get the key used for signing.
Definition: security.h:73
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Aug 10 2020 22:44:46 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.