• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..08-Jan-2021-

doc/H08-Jan-2021-2,9492,300

src/H03-May-2022-15,4698,584

tests/H08-Jan-2021-4,0382,998

Makefile.amH A D03-Dec-2018960 307

Makefile.inH A D08-Jan-202122.1 KiB733630

READMEH A D03-Dec-20184.9 KiB131106

README

1Qt API bindings/wrapper for GPGME
2---------------------------------
3Based on KF5gpgmepp QGpgME and libkleo/backends/qgpgme
4
5Please note that QGpgME has a different license (GPL only)
6then GPGME itself. See the License section in this
7document for more information.
8
9Overview
10--------
11QGpgme provides a very high level Qt API around GpgMEpp.
12As such it depends on GpgMEpp additionally to GpgME.
13
14There are two general concepts in QGpgME. Data abstraction
15through GpgMEpp's Dataprovider interface and the Job pattern.
16
17Data can be provided with QByteArrayDataProvider or
18QIODeviceDataProvider which can be constructed from their
19respective types. This means you can pass a QFile, QProcess,
20QString, etc.. directly to GPGME.
21
22To provide a stable API / ABI and because of historic reasons
23in libkleo (Where QGpgME was originally developed as an abstract
24crypto backend) QGpgME only provides abstract interfaces as
25public API while the actual implementation happens in the
26private QGpgME prefixed classes.
27
28Usage
29-----
30
31To use QGpgME first you need to obtain a Protocol class
32either for CMS (S/MIME) or OpenPGP. This Protocol class
33can then be used to create a Job.
34
35Each Job can be started asynchronusly and emits a result
36signal when done. The jobs are deleted automatically
37with QObject::deleteLater so they can be started without
38result handlers.
39
40The result signal provides a tuple of objects with the
41appropriate result information for this job. For historic
42reasons each result signal also includes an AuditLog
43and an AuditLog Error. These are only useful for
44S/MIME signature validation but are part of other jobs
45for API stability reasons.
46
47Some jobs like the verification or decryption jobs have
48dedicated result classes. Each result class at least
49has the member function error() that can be used
50to check if a job failed. Additionally errors are emitted
51in the result signal.
52
53Jobs also provide progress signal whenever GnuPG emits
54a progress status line.
55
56Most jobs also provide a way synchronusly execute them.
57Please not that synchronous use does not cause the autodeletion
58to take place so you have to manually delete them.
59
60Async usage:
61
62    /* Create a job */
63    EncryptJob *job = openpgp()->encryptJob(/*ASCII Armor */false, /* Textmode */ false);
64    /* Connect something to the result signal */
65    connect(job, &EncryptJob::result, this, [] (const GpgME::EncryptionResult &result,
66                                                const QByteArray &cipherText,
67                                                const QString,
68                                                const GpgME::Error) {
69        /* Handle the result / do something with the ciphertext */
70     });
71    /* Start the job */
72    job->start(keys, inptr, outptr, Context::AlwaysTrust);
73    /* Do not delete the job as it is autodeleted. */
74
75Synchronous usage:
76
77    /* Create a job */
78    KeyListJob *listjob = openpgp()->keyListJob(false, false, false);
79    /* Prepare result vector */
80    std::vector<Key> keys;
81    /* Execute it synchronusly */
82    KeyListResult result = listjob->exec(QStringList() << QStringLiteral("alfa@example.net"),
83                                         false, keys);
84    /* Delete the job */
85    delete listjob;
86    /* Work with the result */
87
88See the generated documentation for more info on the classes
89in QGpgME. (Subdir doc)
90
91Examples / Tests
92----------------
93
94The tests in the tests subdir can be used to get a better
95idea of QGpgME's usage. They also serve to test the C++
96API. Kleopatra and KMails Messagelib also make extensive
97use of QGpgME and can be used as further examples.
98
99Hacking
100-------
101QGpgME comes from a KDE background. As such it does not use
102GNU Coding styles but KDE Coding styles. See:
103https://techbase.kde.org/Policies/Frameworks_Coding_Style
104
105License
106-------
107QGpgME is free software; you can redistribute it and/or
108modify it under the terms of the GNU General Public License as
109published by the Free Software Foundation; either version 2 of the
110License, or (at your option) any later version.
111
112QGpgME is distributed in the hope that it will be useful,
113but WITHOUT ANY WARRANTY; without even the implied warranty of
114MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
115General Public License for more details.
116
117You should have received a copy of the GNU General Public License
118along with this program; if not, write to the Free Software
119Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
120
121In addition, as a special exception, the copyright holders give
122permission to link the code of this program with any edition of
123the Qt library by Trolltech AS, Norway (or with modified versions
124of Qt that use the same license as Qt), and distribute linked
125combinations including the two.  You must obey the GNU General
126Public License in all respects for all of the code used other than
127Qt.  If you modify this file, you may extend this exception to
128your version of the file, but you are not obligated to do so.  If
129you do not wish to do so, delete this exception statement from
130your version.
131