Libkleo

keyresolvercore.h
1/* -*- c++ -*-
2 kleo/keyresolvercore.h
3
4 This file is part of libkleopatra, the KDE keymanagement library
5 SPDX-FileCopyrightText: 2018 Intevation GmbH
6 SPDX-FileCopyrightText: 2021 g10 Code GmbH
7 SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
8
9 SPDX-License-Identifier: GPL-2.0-or-later
10*/
11
12#pragma once
13
14#include "kleo_export.h"
15
16#include <Libkleo/KeyResolver>
17
18#include <QMap>
19#include <QStringList>
20
21#include <gpgme++/global.h>
22
23#include <memory>
24#include <vector>
25
26class QString;
27
28namespace GpgME
29{
30class Key;
31}
32
33namespace Kleo
34{
35
36class KLEO_EXPORT KeyResolverCore
37{
38public:
39 enum SolutionFlags {
40 // clang-format off
41 SomeUnresolved = 0,
42 AllResolved = 1,
43
44 OpenPGPOnly = 2,
45 CMSOnly = 4,
46 MixedProtocols = OpenPGPOnly | CMSOnly,
47
48 Error = 0x1000,
49
50 ResolvedMask = AllResolved | Error,
51 ProtocolsMask = OpenPGPOnly | CMSOnly | Error,
52 // clang-format on
53 };
54 struct Result {
55 SolutionFlags flags;
56 KeyResolver::Solution solution;
57 KeyResolver::Solution alternative;
58 };
59
60 explicit KeyResolverCore(bool encrypt, bool sign, GpgME::Protocol format = GpgME::UnknownProtocol);
61 ~KeyResolverCore();
62
63 void setSender(const QString &sender);
64 QString normalizedSender() const;
65
66 void setRecipients(const QStringList &addresses);
67
68 void setSigningKeys(const QStringList &fingerprints);
69
70 void setOverrideKeys(const QMap<GpgME::Protocol, QMap<QString, QStringList>> &overrides);
71
72 void setAllowMixedProtocols(bool allowMixed);
73
74 void setPreferredProtocol(GpgME::Protocol proto);
75
76 void setMinimumValidity(int validity);
77
78 Result resolve();
79
80private:
81 class Private;
82 std::unique_ptr<Private> d;
83};
84
85} // namespace Kleo
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:14:12 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.