2
* Copyright (C) 2003-2005 Justin Karneges <justin@affinix.com>
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2.1 of the License, or (at your option) any later version.
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Lesser General Public License for more details.
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with this library; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
26
namespace gpgQCAPlugin {
28
class GpgOp : public QObject
35
SecretKeyringFile, // --list-secret-keys
36
PublicKeyringFile, // --list-public-keys
37
SecretKeys, // --fixed-list-mode --with-colons --list-secret-keys
38
PublicKeys, // --fixed-list-mode --with-colons --list-public-keys
42
SignAndEncrypt, // --sign --encrypt
43
SignClearsign, // --clearsign
44
SignDetached, // --detach-sign
46
VerifyDetached, // --verify
53
VerifyGood, // good sig
55
VerifyNoKey // we don't have signer's public key
60
ErrorProcess, // startup, process, or ipc error
61
ErrorPassphrase, // passphrase was either wrong or not provided
62
ErrorFormat, // input format was bad
63
ErrorSignerExpired, // signing key is expired
64
ErrorEncryptExpired, // encrypting key is expired
65
ErrorEncryptUntrusted, // encrypting key is untrusted
66
ErrorEncryptInvalid, // encrypting key is invalid in some way
67
ErrorDecryptNoKey, // missing decrypt key
68
ErrorUnknown // other error
82
ReadyReadDiagnosticText
86
int written; // BytesWritten
87
QString keyId; // NeedPassphrase
89
Event() : type(None), written(0) {}
114
QDateTime creationDate;
115
QDateTime expirationDate;
116
int caps; // flags OR'd together
119
KeyItem() : type(Unknown), bits(0), caps(0) {}
125
QList<KeyItem> keyItems; // first item is primary
129
Key() : isTrusted(false) {}
131
typedef QList<Key> KeyList;
133
explicit GpgOp(const QString &bin, QObject *parent = 0);
138
bool isActive() const;
141
void setAsciiFormat(bool b);
142
void setDisableAgent(bool b);
143
void setAlwaysTrust(bool b);
144
void setKeyrings(const QString &pubfile, const QString &secfile); // for keylists and import
147
void doSecretKeyringFile();
148
void doPublicKeyringFile();
151
void doEncrypt(const QStringList &recip_ids);
153
void doSign(const QString &signer_id);
154
void doSignAndEncrypt(const QString &signer_id, const QStringList &recip_ids);
155
void doSignClearsign(const QString &signer_id);
156
void doSignDetached(const QString &signer_id);
158
void doVerifyDetached(const QByteArray &sig);
159
void doImport(const QByteArray &in);
160
void doExport(const QString &key_id);
163
void submitPassphrase(const QCA::SecureArray &a);
165
void submitPassphrase(const QByteArray &a);
169
// for encrypt, decrypt, sign, verify, export
171
void write(const QByteArray &in);
174
QString readDiagnosticText();
176
// for synchronous operation
177
Event waitForEvent(int msecs = -1);
180
bool success() const;
181
Error errorCode() const;
182
KeyList keys() const; // Keys
183
QString keyringFile() const; // KeyringFile
184
QString encryptedToId() const; // Decrypt (for ErrorDecryptNoKey)
185
bool wasSigned() const; // Decrypt
186
QString signerId() const; // Verify
187
QDateTime timestamp() const; // Verify
188
VerifyResult verifyResult() const; // Verify
192
void bytesWritten(int bytes);
194
void needPassphrase(const QString &keyId);
196
void readyReadDiagnosticText();
200
friend class Private;