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

KNewStuff

  • sources
  • kde-4.12
  • kdelibs
  • 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
KNS::Security::MD5_OK
Definition: knewstuff2/core/security.h:85
KProcess
KNS::Security::SIGNED_BAD_CLEAR
The key is unknown.
Definition: knewstuff2/core/security.h:90
QString
KNS::Security::readKeys
void readKeys()
Reads the available public keys.
Definition: knewstuff2/core/security.cpp:55
QObject
KNS::Security::slotCheckValidity
void slotCheckValidity()
Verifies the integrity and the signature of a tarball file (see m_fileName).
Definition: knewstuff2/core/security.cpp:222
KNS::Security::BAD_PASSPHRASE
used to clear the SIGNED_BAD flag
Definition: knewstuff2/core/security.h:91
KeyStruct
Definition: knewstuff2/core/security.h:27
KNS::Security::TRUSTED
The file is signed with a bad signature.
Definition: knewstuff2/core/security.h:88
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:285
KNS::Security
Handles security related issues, like signing, verifying.
Definition: knewstuff2/core/security.h:47
KNS::Security::checkValidity
void checkValidity(const QString &fileName)
Verifies the integrity and the signature of a tarball file.
Definition: knewstuff2/core/security.cpp:216
KNS::Security::SIGNED_OK
The MD5 sum check is OK.
Definition: knewstuff2/core/security.h:86
KNS::Security::UNKNOWN
The signature is trusted.
Definition: knewstuff2/core/security.h:89
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:291
KeyStruct::id
QString id
Definition: knewstuff2/core/security.h:28
KeyStruct::name
QString name
Definition: knewstuff2/core/security.h:29
KeyStruct::secret
bool secret
Definition: knewstuff2/core/security.h:32
KNS::Security::signatureKey
KeyStruct signatureKey()
Get the key used for signing.
Definition: knewstuff2/core/security.h:80
KNS::Security::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::Results
Results
Definition: knewstuff2/core/security.h:84
KeyStruct::trusted
bool trusted
Definition: knewstuff2/core/security.h:31
KNS::Security::readSecretKeys
void readSecretKeys()
Reads the available secret keys.
Definition: knewstuff2/core/security.cpp:82
KNS::Security::validityResult
void validityResult(int result)
Sent when the validity check is done.
KNS::Security::fileSigned
void fileSigned(int result)
Sent when the signing is done.
KNS::Security::~Security
~Security()
Definition: knewstuff2/core/security.cpp:51
QMap< QString, KeyStruct >
KeyStruct::mail
QString mail
Definition: knewstuff2/core/security.h:30
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:50:49 by doxygen 1.8.7 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 API Reference

Skip menu "kdelibs 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
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



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