1 | /*
|
---|
2 | * gnupg.h - OpenPGP interface to GnuPG
|
---|
3 | * Copyright (C) 2003 Justin Karneges
|
---|
4 | *
|
---|
5 | * This program is free software; you can redistribute it and/or
|
---|
6 | * modify it under the terms of the GNU General Public License
|
---|
7 | * as published by the Free Software Foundation; either version 2
|
---|
8 | * of the License, or (at your option) any later version.
|
---|
9 | *
|
---|
10 | * This program is distributed in the hope that it will be useful,
|
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
13 | * GNU General Public License for more details.
|
---|
14 | *
|
---|
15 | * You should have received a copy of the GNU General Public License
|
---|
16 | * along with this library; if not, write to the Free Software
|
---|
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
18 | *
|
---|
19 | */
|
---|
20 |
|
---|
21 | #ifndef GNUPG_H
|
---|
22 | #define GNUPG_H
|
---|
23 |
|
---|
24 | #include"openpgp.h"
|
---|
25 |
|
---|
26 | class GnuPG : public OpenPGP::Engine
|
---|
27 | {
|
---|
28 | Q_OBJECT
|
---|
29 | public:
|
---|
30 | GnuPG(QObject *parent=0);
|
---|
31 | ~GnuPG();
|
---|
32 |
|
---|
33 | void setTryAgent(bool);
|
---|
34 |
|
---|
35 | bool checkAvailability();
|
---|
36 | QString id() const;
|
---|
37 | QString name() const;
|
---|
38 |
|
---|
39 | void init();
|
---|
40 | OpenPGP::KeyList secretKeys() const;
|
---|
41 | OpenPGP::KeyList publicKeys() const;
|
---|
42 |
|
---|
43 | protected:
|
---|
44 | void encrypt(OpenPGP::Request *, const QByteArray &in, const QStringList &keys);
|
---|
45 | void decrypt(OpenPGP::Request *, const QString &in);
|
---|
46 | void sign(OpenPGP::Request *, const QByteArray &in, const QString &keyID);
|
---|
47 | void verify(OpenPGP::Request *, const QByteArray &in, const QString &sig);
|
---|
48 | void submitPassphrase(OpenPGP::Request *, const QString &);
|
---|
49 |
|
---|
50 | private slots:
|
---|
51 | void gpg_finished(bool);
|
---|
52 | void gpg_needPassphrase();
|
---|
53 |
|
---|
54 | void req_destroyed();
|
---|
55 | void doNext();
|
---|
56 | void fileChanged();
|
---|
57 |
|
---|
58 | public:
|
---|
59 | class Item;
|
---|
60 | private:
|
---|
61 | class Private;
|
---|
62 | Private *d;
|
---|
63 |
|
---|
64 | void tryNext();
|
---|
65 |
|
---|
66 | Item *find(OpenPGP::Request *) const;
|
---|
67 | void hook(Item *);
|
---|
68 | OpenPGP::Request *unhook(Item *);
|
---|
69 | OpenPGP::Request *unhookFirst();
|
---|
70 |
|
---|
71 | void handleDirtyRings();
|
---|
72 | void doInitFinished(bool, const QString &);
|
---|
73 | };
|
---|
74 |
|
---|
75 | #endif
|
---|