1 | /* |
2 | * Copyright (C) 2003-2008 Justin Karneges <justin@affinix.com> |
3 | * |
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. |
8 | * |
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. |
13 | * |
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 St, Fifth Floor, Boston, MA 02110-1301, USA |
17 | */ |
18 | |
19 | #pragma once |
20 | |
21 | #include "gpgop.h" |
22 | #include "qcaprovider.h" |
23 | #include "ringwatch.h" |
24 | |
25 | namespace gpgQCAPlugin { |
26 | |
27 | class MyPGPKeyContext : public QCA::PGPKeyContext |
28 | { |
29 | Q_OBJECT |
30 | public: |
31 | QCA::PGPKeyContextProps _props; |
32 | |
33 | // keys loaded externally (not from the keyring) need to have these |
34 | // values cached, since we can't extract them later |
35 | QByteArray cacheExportBinary; |
36 | QString cacheExportAscii; |
37 | |
38 | MyPGPKeyContext(QCA::Provider *p); |
39 | |
40 | // reimplemented Provider::Context |
41 | QCA::Provider::Context *clone() const override; |
42 | |
43 | // reimplemented PGPKeyContext |
44 | const QCA::PGPKeyContextProps *props() const override; |
45 | |
46 | QByteArray toBinary() const override; |
47 | QCA::ConvertResult fromBinary(const QByteArray &a) override; |
48 | |
49 | QString toAscii() const override; |
50 | QCA::ConvertResult fromAscii(const QString &s) override; |
51 | |
52 | void set(const GpgOp::Key &i, bool isSecret, bool inKeyring, bool isTrusted); |
53 | static void cleanup_temp_keyring(const QString &name); |
54 | }; |
55 | |
56 | } // end namespace gpgQCAPlugin |
57 | |