KIO

ksslcertificatemanager.h
1/*
2 This file is part of the KDE project
3 SPDX-FileCopyrightText: 2007, 2008, 2010 Andreas Hartmetz <ahartmetz@gmail.com>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef _INCLUDE_KSSLCERTIFICATEMANAGER_H
9#define _INCLUDE_KSSLCERTIFICATEMANAGER_H
10
11#include <QDate>
12#include <QSslCertificate>
13#include <QSslError>
14#include <QString>
15#include <QStringList>
16
17#include "kiocore_export.h"
18
19#include <memory>
20
21class QDBusArgument;
22class KSslCertificateRulePrivate;
23class KSslCertificateManagerPrivate;
24
25// ### document this... :/
26/** Certificate rule. */
27class KIOCORE_EXPORT KSslCertificateRule
28{
29public:
30 KSslCertificateRule(const QSslCertificate &cert = QSslCertificate(), const QString &hostName = QString());
33 KSslCertificateRule &operator=(const KSslCertificateRule &other);
34
35 QSslCertificate certificate() const;
36 QString hostName() const;
37 void setExpiryDateTime(const QDateTime &dateTime);
38 QDateTime expiryDateTime() const;
39 void setRejected(bool rejected);
40 bool isRejected() const;
41 /**
42 * Returns whether @p error is ignored for this certificate.
43 * @since 5.64
44 */
45 bool isErrorIgnored(QSslError::SslError error) const;
46 /**
47 * Set the ignored errors for this certificate.
48 * @since 5.64
49 */
50 void setIgnoredErrors(const QList<QSslError> &errors);
51 /**
52 * Set the ignored errors for this certificate.
53 * @since 5.64
54 */
55 void setIgnoredErrors(const QList<QSslError::SslError> &errors);
56 QList<QSslError::SslError> ignoredErrors() const;
57 /**
58 * Filter out errors that are already ignored.
59 * @since 5.64
60 */
61 QList<QSslError> filterErrors(const QList<QSslError> &errors) const;
62
63private:
64 std::unique_ptr<KSslCertificateRulePrivate> const d;
65};
66
67// ### document this too... :/
68/** Certificate manager. */
69class KIOCORE_EXPORT KSslCertificateManager
70{
71public:
72 static KSslCertificateManager *self();
73
74 // TODO: the rule functions are not working if there is no DBus with a working kiod
75 void setRule(const KSslCertificateRule &rule);
76 void clearRule(const KSslCertificateRule &rule);
77 void clearRule(const QSslCertificate &cert, const QString &hostName);
78 KSslCertificateRule rule(const QSslCertificate &cert, const QString &hostName) const;
79
80 QList<QSslCertificate> caCertificates() const;
81
82 /**
83 * Returns the subset of @p errors that cannot be ignored, ie. that is considered fatal.
84 * @since 5.64
85 */
86 static QList<QSslError> nonIgnorableErrors(const QList<QSslError> &errors);
87
88private:
89 friend class KSslCertificateManagerContainer;
90 friend class KSslCertificateManagerPrivate;
91 KIOCORE_NO_EXPORT KSslCertificateManager();
92 KIOCORE_NO_EXPORT ~KSslCertificateManager();
93
94 std::unique_ptr<KSslCertificateManagerPrivate> d;
95};
96
97#endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:50:33 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.