2
* openpgp.h - OpenPGP base
3
* Copyright (C) 2003 Justin Karneges
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.
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.
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
26
#include<qvaluelist.h>
32
enum { None, Encrypt, Decrypt, Sign, Verify };
33
enum { VerifyGood, VerifyBad, VerifyNoKey, VerifyError };
42
const QString & keyID() const;
43
const QString & userID() const;
44
void setKeyID(const QString &);
45
void setUserID(const QString &);
52
typedef QValueList<Key> KeyList;
54
class Request : public QObject
63
void encrypt(const QByteArray &in, const QStringList &keys);
64
void decrypt(const QString &in);
65
void sign(const QByteArray &in, const QString &keyID);
66
void verify(const QByteArray &in, const QString &sig);
68
void submitPassphrase(const QString &);
70
QString encrypted() const;
71
QByteArray decrypted() const;
72
QString signature() const;
73
QString keyID() const;
74
QDateTime timestamp() const;
75
int verifyResult() const;
77
bool badPassphrase() const;
81
void needPassphrase();
88
void op_encryptFinished(bool, const QString &);
89
void op_decryptFinished(bool, const QByteArray &);
90
void op_signFinished(bool, const QString &);
91
void op_verifyFinished(int, const QString &, const QDateTime &);
92
void op_needPassphrase();
93
void op_setBadPassphrase(bool);
96
class Engine : public QObject
100
Engine(QObject *parent=0);
103
virtual bool checkAvailability()=0;
104
virtual QString id() const=0;
105
virtual QString name() const=0;
107
virtual void init()=0;
108
virtual KeyList secretKeys() const=0;
109
virtual KeyList publicKeys() const=0;
112
void initFinished(bool, const QString &);
116
friend class Request;
117
virtual void encrypt(Request *, const QByteArray &, const QStringList &keys)=0;
118
virtual void decrypt(Request *, const QString &)=0;
119
virtual void sign(Request *, const QByteArray &, const QString &keyID)=0;
120
virtual void verify(Request *, const QByteArray &, const QString &sig)=0;
121
virtual void submitPassphrase(Request *, const QString &)=0;
122
void encryptFinished(Request *, bool, const QString &);
123
void decryptFinished(Request *, bool, const QByteArray &);
124
void signFinished(Request *, bool, const QString &);
125
void verifyFinished(Request *, int, const QString &, const QDateTime &);
126
void needPassphrase(Request *);
127
void setBadPassphrase(Request *, bool);
130
typedef QPair<QString,QString> EngineItem;
132
QValueList<EngineItem> getAllEngines();
133
QValueList<EngineItem> getAvailableEngines();
134
Engine * createEngine(const QString &);
136
QString stripHeaderFooter(const QString &);
137
QString addHeaderFooter(const QString &, int);