00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef KGPGINTERFACE_H
00019 #define KGPGINTERFACE_H
00020
00021 #include <QPixmap>
00022
00023
00024 #include <KUrl>
00025
00026 #include <kgpgkey.h>
00027
00028 class KTemporaryFile;
00029 class KProcess;
00030 class GPGProc;
00031
00035 class KgpgInterface : public QObject
00036 {
00037 Q_OBJECT
00038
00039 public:
00043 KgpgInterface();
00044 ~KgpgInterface();
00045
00046 static QString checkForUtf8(QString txt);
00047 static QString checkForUtf8bis(QString txt);
00048
00057 static int gpgVersion(const QString &vstr);
00066 static QString gpgVersionString(const QString &binary);
00075 static QString getGpgHome(const QString &binary);
00076
00077 static QStringList getGpgGroupNames(const QString &configfile);
00078 static QStringList getGpgGroupSetting(const QString &name, const QString &configfile);
00079 static void setGpgGroupSetting(const QString &name, const QStringList &values, const QString &configfile);
00080 static void delGpgGroup(const QString &name, const QString &configfile);
00081
00082 static QString getGpgSetting(QString name, const QString &configfile);
00083 static void setGpgSetting(const QString &name, const QString &value, const QString &url);
00084
00085 static bool getGpgBoolSetting(const QString &name, const QString &configfile);
00086 static void setGpgBoolSetting(const QString &name, const bool &enable, const QString &url);
00087
00096 static int sendPassphrase(const QString &text, KProcess *process, const bool isnew = true);
00097
00098 private:
00099 KProcess *m_workProcess;
00100
00101 static QString getGpgProcessHome(const QString &binary);
00102
00103
00104 void updateIDs(QString txt);
00105
00106
00107
00108
00109
00110 signals:
00111 void readPublicKeysFinished(KgpgCore::KgpgKeyList, KgpgInterface*);
00112
00113 public slots:
00114 KgpgCore::KgpgKeyList readPublicKeys(const bool &block = false, const QStringList &ids = QStringList(), const bool &withsigs = false);
00115 KgpgCore::KgpgKeyList readPublicKeys(const bool &block, const QString &ids, const bool &withsigs = false)
00116 { return readPublicKeys(block, QStringList(ids), withsigs); }
00117
00118 private slots:
00119 void readPublicKeysProcess(GPGProc *p);
00120 void readPublicKeysFin(GPGProc *p, const bool &block = false);
00121
00122 private:
00123 int m_numberid;
00124 QString cycle;
00125 KgpgCore::KgpgKey m_publickey;
00126 KgpgCore::KgpgKeyList m_publiclistkeys;
00127
00128
00129
00130
00131
00132 public slots:
00133 KgpgCore::KgpgKeyList readSecretKeys(const QStringList &ids = QStringList());
00134 KgpgCore::KgpgKeyList readJoinedKeys(const KgpgCore::KgpgKeyTrust &trust, const QStringList &ids = QStringList());
00135
00136 private slots:
00137 void readSecretKeysProcess(GPGProc *p);
00138
00139 private:
00140 bool m_secretactivate;
00141 KgpgCore::KgpgKey m_secretkey;
00142 KgpgCore::KgpgKeyList m_secretlistkeys;
00143
00144
00145
00146
00147
00148 signals:
00149 void getKeysFinished(QString, KgpgInterface*);
00150
00151 public slots:
00152 QString getKeys(const QString *attributes = NULL, const QStringList &ids = QStringList());
00153
00154 private slots:
00155 void getKeysProcess(GPGProc *);
00156 void getKeysFin(GPGProc *);
00157
00158 private:
00159 QString m_keystring;
00160
00161
00162
00163
00164
00165 signals:
00174 void signKeyFinished(int, const QString &, KgpgInterface*);
00175
00176 public slots:
00185 void signKey(const QString &keyid, const QString &signkeyid, const bool &local, const int &checking, const bool &terminal = false, const QString &uid = QString());
00186
00187 private slots:
00191 void signKeyProcess();
00192
00196 void signKeyFin();
00197
00202 void signKeyOpenConsole();
00203
00204 private:
00205 QString m_signkey;
00206 QString m_keyid;
00207 int m_checking;
00208 bool m_local;
00209
00210
00211
00212
00213
00214 signals:
00215 void loadPhotoFinished(QPixmap, KgpgInterface*);
00216
00217 public slots:
00218 QPixmap loadPhoto(const QString &keyid, const QString &uid, const bool &block = false);
00219
00220 private slots:
00221 void loadPhotoFin(int exitCode);
00222
00223 private:
00224 QPixmap m_pixmap;
00225 KTemporaryFile *m_kgpginfotmp;
00226
00227
00228
00229
00230
00231 signals:
00232 void importKeyFinished(KgpgInterface *, QStringList);
00233
00234 public slots:
00239 void importKey(const KUrl &url);
00240
00245 void importKey(const QString &keystr);
00246
00247 private slots:
00251 void importKeyProcess(GPGProc *p);
00252 void slotImportKeyFinished(GPGProc *p);
00253
00254 private:
00255 QString m_tempkeyfile;
00256
00257
00258
00259
00260
00261 signals:
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277 void downloadKeysFinished(QList<int>, QStringList, bool, QString, KgpgInterface*);
00278 void downloadKeysAborted(KgpgInterface*);
00279
00280 public slots:
00281 void downloadKeys(const QStringList &keys, const QString &keyserver, const bool &refresh, const QString &proxy = "");
00282 void downloadKeysAbort();
00283
00284 private slots:
00285 void downloadKeysProcess(GPGProc *p);
00286 void downloadKeysFin(GPGProc *p);
00287
00288 private:
00289 GPGProc *m_downloadprocess;
00290 QString m_downloadkeys;
00291 QString m_downloadkeys_log;
00292
00293
00294
00295
00296
00297
00298 signals:
00299 void uploadKeysFinished(QString, KgpgInterface*);
00300 void uploadKeysAborted(KgpgInterface*);
00301
00302 public slots:
00303 void uploadKeys(const QStringList &keys, const QString &keyserver, const QString &attributes, const QString &proxy = "");
00304 void uploadKeysAbort();
00305
00306 private slots:
00307 void uploadKeysProcess(GPGProc *p);
00308 void uploadKeysFin(GPGProc *p);
00309
00310 private:
00311 GPGProc *m_uploadprocess;
00312 QString m_uploadkeys_log;
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328 public slots:
00329
00335 void KgpgDelSignature(const QString &keyID, const QString &uid, QString signKeyID);
00336
00337 void KgpgRevokeKey(const QString &keyID, const QString &revokeUrl, const int reason, const QString &description);
00338 void revokeover(GPGProc *);
00339 void revokeprocess(GPGProc *p);
00340
00341
00342 private slots:
00346 void delsigprocess(GPGProc *p);
00347
00351 void delsignover(GPGProc *p);
00352
00356 void findSigns(const QString &keyID, const QStringList &ids, const QString &uid, QList<int> *res);
00357
00361 void importURLover(GPGProc *p);
00362
00363 signals:
00367 void delsigfinished(bool);
00368
00369 void revokecertificate(QString);
00370 void revokeurl(QString);
00371
00372 private:
00373
00374 int m_success;
00375 QString m_partialline;
00376 bool m_ispartial;
00377 QString message;
00378 QString userIDs;
00379 QString log;
00380 KProcess *editprocess;
00381
00385 QString output;
00386
00387 bool deleteSuccess;
00388 bool revokeSuccess;
00389 bool addSuccess;
00390 bool delSuccess;
00391
00392 int expSuccess;
00393 int step;
00394 int signb;
00395 int sigsearch;
00396 int expirationDelay;
00397 int revokeReason;
00398 int photoCount;
00399 QString revokeDescription;
00400 QString certificateUrl;
00401 QString photoUrl;
00402 QString decryptUrl;
00403
00404 QString gpgOutput;
00405 };
00406
00407 #endif // KGPGINTERFACE_H