1 /* wkspublishjob.h 2 3 Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik 4 Software engineering by Intevation GmbH 5 6 QGpgME is free software; you can redistribute it and/or 7 modify it under the terms of the GNU General Public License as 8 published by the Free Software Foundation; either version 2 of the 9 License, or (at your option) any later version. 10 11 QGpgME 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 General Public License for more details. 15 16 You should have received a copy of the GNU General Public License along 17 with this program; if not, write to the Free Software Foundation, Inc., 18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 20 In addition, as a special exception, the copyright holders give 21 permission to link the code of this program with any edition of 22 the Qt library by Trolltech AS, Norway (or with modified versions 23 of Qt that use the same license as Qt), and distribute linked 24 combinations including the two. You must obey the GNU General 25 Public License in all respects for all of the code used other than 26 Qt. If you modify this file, you may extend this exception to 27 your version of the file, but you are not obligated to do so. If 28 you do not wish to do so, delete this exception statement from 29 your version. 30 */ 31 #ifndef QGPGME_WKSPUBLISHJOB_H 32 #define QGPGME_WKSPUBLISHJOB_H 33 34 #include "job.h" 35 36 #include "qgpgme_export.h" 37 38 namespace GpgME 39 { 40 class Key; 41 } // namespace GpgME 42 43 namespace QGpgME { 44 45 /** 46 * Handles Web Key Service Publishing. Needs WKS tools installed and 47 * server support. 48 * 49 * Remember that after a result is emitted the job is auto deleted 50 * so you can only use it for a single action. 51 * 52 * The workflow is to call startCreate, check for errors and then 53 * send the RFC822 mail returned in returnedData. 54 * 55 * When the response is received start a startRecieve with the 56 * RFC822 mail received as parameter response. Check for errors 57 * and then send again send the result from returnedData back to 58 * the server. 59 * 60 */ 61 class QGPGME_EXPORT WKSPublishJob: public Job 62 { 63 Q_OBJECT 64 protected: 65 explicit WKSPublishJob(QObject *parent); 66 public: 67 ~WKSPublishJob(); 68 69 70 /** Start a check if WKS Publishing is supported. As this involves 71 * an HTTP Query it might take a while. Returns GPG_ERR_NOT_SUPPORED 72 * result if GnuPG is too old or the required tools are not installed. 73 * 74 * The error GPG_ERR_NOT_ENABLED indicates that wks-tools failed to 75 * detect a working wks service for this. 76 * 77 * @param the mailbox to check for. 78 **/ 79 virtual void startCheck(const QString &mailbox) = 0; 80 81 /** Create a publish request. 82 * The returnedData from the result signal will contain 83 * the full Request as returned by gpg-wks-client --create 84 * 85 * @param fpr the fingerprint of the key to create the request for. 86 * @param mailbox A simple mail address without a Name. 87 */ 88 virtual void startCreate(const char *fpr, const QString &mailbox) = 0; 89 90 /** Handle a submission response. The returnedData in the result singnal 91 * will contain the confirmation response as returned by gpg-wks-client --receive 92 * 93 * @param response The response of the server. 94 **/ 95 virtual void startReceive(const QByteArray &response) = 0; 96 97 Q_SIGNALS: 98 /* Result of the operation returned Data and returned Error are 99 * the results from gpg-wks-client's stdout or stderr respectively. 100 * 101 * As usual auditLogAsHtml and auditLogError can be ignored. 102 **/ 103 void result(const GpgME::Error &error, const QByteArray &returnedData, 104 const QByteArray &returnedError, 105 const QString &auditLogAsHtml = QString(), 106 const GpgME::Error &auditLogError = GpgME::Error()); 107 }; 108 109 } 110 111 #endif 112