Changeset View
Changeset View
Standalone View
Standalone View
src/kleo/tofu.h
- This file was added.
1 | /* This file is part of Kleopatra, the KDE keymanager | ||||
---|---|---|---|---|---|
2 | Copyright (c) 2016 Klarälvdalens Datakonsult AB | ||||
3 | | ||||
4 | Kleopatra is free software; you can redistribute it and/or modify | ||||
5 | it under the terms of the GNU General Public License as published by | ||||
6 | the Free Software Foundation; either version 2 of the License, or | ||||
7 | (at your option) any later version. | ||||
8 | | ||||
9 | Kleopatra 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 | General Public License for more details. | ||||
13 | | ||||
14 | You should have received a copy of the GNU General Public License | ||||
15 | along with this program; if not, write to the Free Software | ||||
16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||||
17 | */ | ||||
18 | | ||||
19 | #ifndef KLEO_TOFU_H_ | ||||
20 | #define KLEO_TOFU_H_ | ||||
21 | | ||||
22 | #include "kleo_export.h" | ||||
23 | | ||||
24 | namespace Kleo { | ||||
25 | | ||||
26 | namespace TOFU { | ||||
27 | | ||||
28 | /** | ||||
29 | * Returns whether currently installed version of GnuPG supports the | ||||
30 | * TOFU trust model | ||||
31 | * | ||||
32 | * @since 5.4 | ||||
33 | */ | ||||
34 | KLEO_EXPORT bool isSupported(); | ||||
35 | | ||||
36 | /** | ||||
37 | * Returns whether TOFU trust model is enabled. | ||||
38 | * | ||||
39 | * Returns false when TOFU is not supported by the currently installed | ||||
40 | * version of GnuPG. | ||||
41 | * | ||||
42 | * @since 5.4 | ||||
43 | */ | ||||
44 | KLEO_EXPORT bool isEnabled(); | ||||
45 | | ||||
46 | /** | ||||
47 | * Toggles whether TOFU trust mode. | ||||
48 | * | ||||
49 | * This function modifies $GNUPG_HOME/gpg.conf configuration file and | ||||
50 | * sets trust-model to tofu when @p enabled is true or removes the line | ||||
51 | * when @p enabled is false. | ||||
52 | * | ||||
53 | * When @p enabled is true and the configuration file already has trust-model | ||||
54 | * set to tofu or tofu+pgp, this method does nothing. | ||||
55 | * | ||||
56 | * @since 5.4 | ||||
57 | */ | ||||
58 | KLEO_EXPORT bool setEnabled(bool enabled); | ||||
59 | | ||||
60 | } | ||||
61 | | ||||
62 | } | ||||
63 | | ||||
64 | #endif |