• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KNewStuff

  • knewstuff
  • knewstuff2
  • core
knewstuff2/core/security.h
Go to the documentation of this file.
1 /*
2  This file is part of KNewStuff2.
3  Copyright (c) 2004, 2005 Andras Mantia <amantia@kde.org>
4  Copyright (c) 2007 Josef Spillner <spillner@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public
17  License along with this library. If not, see <http://www.gnu.org/licenses/>.
18 */
19 #ifndef KNEWSTUFF2_SECURITY_H
20 #define KNEWSTUFF2_SECURITY_H
21 
22 //qt includes
23 #include <QtCore/QMap>
24 #include <QtCore/QObject>
25 #include <QtCore/QProcess>
26 
27 struct KeyStruct {
28  QString id;
29  QString name;
30  QString mail;
31  bool trusted;
32  bool secret;
33 };
34 
35 class KProcess;
36 namespace KNS
37 {
38 
47 class Security : public QObject
48 {
49  Q_OBJECT
50 public:
51  static Security* ref() {
52  static Security *m_ref;
53  if (!m_ref) m_ref = new Security();
54  return m_ref;
55  }
56  ~Security();
57 
58 
64  void checkValidity(const QString &fileName);
65 
72  void signFile(const QString &fileName);
73 
80  KeyStruct signatureKey() {
81  return m_signatureKey;
82  }
83 
84  enum Results {
85  MD5_OK = 1,
86  SIGNED_OK = 2,
87  SIGNED_BAD = 4,
88  TRUSTED = 8,
89  UNKNOWN = 16,
90  SIGNED_BAD_CLEAR = 27,
91  BAD_PASSPHRASE = 32
92  };
93 
94 public Q_SLOTS:
95 
97  void readKeys();
98 
100  void readSecretKeys();
101 
104  void slotCheckValidity();
105 
109  void slotSignFile();
110 
111 private:
112  Security();
113 
114  enum RunMode {
115  List = 0,
116  ListSecret,
117  Verify,
118  Sign
119  };
120 
121  KeyStruct m_signatureKey;
122  int m_result;
123  int m_runMode;
124  bool m_gpgRunning;
125  bool m_keysRead;
126  QMap<QString, KeyStruct> m_keys;
127  QString m_fileName;
128  QString m_secretKey;
129  KProcess *m_process;
130 
131 private Q_SLOTS:
132  void slotFinished(int exitCode, QProcess::ExitStatus exitStatus);
133  void slotReadyReadStandardOutput();
134 
135 Q_SIGNALS:
140  void validityResult(int result);
141 
146  void fileSigned(int result);
147 };
148 
149 }
150 
151 #endif
QObject
KNS::Security::checkValidity
void checkValidity(const QString &fileName)
Verifies the integrity and the signature of a tarball file.
Definition: knewstuff2/core/security.cpp:227
KeyStruct::name
QString name
Definition: knewstuff2/core/security.h:29
KNS::Security::readKeys
void readKeys()
Reads the available public keys.
Definition: knewstuff2/core/security.cpp:66
KNS::Security::Results
Results
Definition: knewstuff2/core/security.h:84
KeyStruct::secret
bool secret
Definition: knewstuff2/core/security.h:32
KNS::Security::SIGNED_BAD
@ SIGNED_BAD
The file is signed with a good signature.
Definition: knewstuff2/core/security.h:87
KNS::Security::ref
static Security * ref()
Definition: knewstuff2/core/security.h:51
KNS::Security::TRUSTED
@ TRUSTED
The file is signed with a bad signature.
Definition: knewstuff2/core/security.h:88
KNS::Security::fileSigned
void fileSigned(int result)
Sent when the signing is done.
KNS::Security::readSecretKeys
void readSecretKeys()
Reads the available secret keys.
Definition: knewstuff2/core/security.cpp:93
QMap< QString, KeyStruct >
KNS::Security::SIGNED_BAD_CLEAR
@ SIGNED_BAD_CLEAR
The key is unknown.
Definition: knewstuff2/core/security.h:90
KeyStruct
Definition: knewstuff2/core/security.h:27
KNS::Security::signFile
void signFile(const QString &fileName)
Creates a signature and an md5sum file for the fileName and packs everything into a gzipped tarball.
Definition: knewstuff2/core/security.cpp:296
KNS::Security
Handles security related issues, like signing, verifying.
Definition: knewstuff2/core/security.h:47
KeyStruct::mail
QString mail
Definition: knewstuff2/core/security.h:30
KNS::Security::SIGNED_OK
@ SIGNED_OK
The MD5 sum check is OK.
Definition: knewstuff2/core/security.h:86
KProcess
KNS::Security::validityResult
void validityResult(int result)
Sent when the validity check is done.
KNS::Security::~Security
~Security()
Definition: knewstuff2/core/security.cpp:62
KNS
Definition: knewstuff2/core/author.h:26
KNS::Security::BAD_PASSPHRASE
@ BAD_PASSPHRASE
used to clear the SIGNED_BAD flag
Definition: knewstuff2/core/security.h:91
KNS::Security::signatureKey
KeyStruct signatureKey()
Get the key used for signing.
Definition: knewstuff2/core/security.h:80
KeyStruct::id
QString id
Definition: knewstuff2/core/security.h:28
KNS::Security::UNKNOWN
@ UNKNOWN
The signature is trusted.
Definition: knewstuff2/core/security.h:89
KNS::Security::slotCheckValidity
void slotCheckValidity()
Verifies the integrity and the signature of a tarball file (see m_fileName).
Definition: knewstuff2/core/security.cpp:233
KNS::Security::MD5_OK
@ MD5_OK
Definition: knewstuff2/core/security.h:85
KNS::Security::slotSignFile
void slotSignFile()
Creates a signature and an md5sum file for the m_fileName and packs everything into a gzipped tarball...
Definition: knewstuff2/core/security.cpp:302
KeyStruct::trusted
bool trusted
Definition: knewstuff2/core/security.h:31
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun Jan 19 2020 00:00:00 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KNewStuff

Skip menu "KNewStuff"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal