1/*
2 This file is part of the KDE project
3 SPDX-FileCopyrightText: 2000-2003 George Staikos <staikos@kde.org>
4 SPDX-FileCopyrightText: 2000 Malte Starostik <malte@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8
9#ifndef _KSSLINFODIALOG_H
10#define _KSSLINFODIALOG_H
11
12#include <QDialog>
13#include <QSslError>
14
15#include "kiowidgets_export.h"
16
17#include <memory>
18
19/*!
20 * \class KSslInfoDialog
21 * \inmodule KIOWidgets
22 *
23 * \brief KDE SSL Information Dialog.
24 *
25 * This class creates a dialog that can be used to display information about
26 * an SSL session.
27 */
28class KIOWIDGETS_EXPORT KSslInfoDialog : public QDialog
29{
30 Q_OBJECT
31public:
32 /*!
33 * Construct a KSSL Information Dialog
34 *
35 * \a parent the parent widget
36 */
37 explicit KSslInfoDialog(QWidget *parent = nullptr);
38
39 ~KSslInfoDialog() override;
40
41 /*!
42 * Set information to display about the SSL connection.
43 *
44 * \a certificateChain the certificate chain leading from the certificate
45 * authority to the peer.
46 *
47 * \a ip the ip of the remote host
48 *
49 * \a host the remote hostname
50 *
51 * \a sslProtocol the version of SSL in use (SSLv2, SSLv3, TLSv1)
52 *
53 * \a cipher the cipher in use
54 *
55 * \a usedBits the used bits of the key
56 *
57 * \a bits the key size of the cipher in use
58 *
59 * \a validationErrors errors validating the certificates, if any
60 *
61 * \since 5.64
62 */
63 void setSslInfo(const QList<QSslCertificate> &certificateChain,
64 const QString &ip,
65 const QString &host,
66 const QString &sslProtocol,
67 const QString &cipher,
68 int usedBits,
69 int bits,
70 const QList<QList<QSslError::SslError>> &validationErrors);
71
72 /*!
73 *
74 */
75 void setMainPartEncrypted(bool);
76
77 /*!
78 *
79 */
80 void setAuxiliaryPartsEncrypted(bool);
81
82 /*!
83 * Converts certificate errors as provided in the "ssl_cert_errors" meta data
84 * to a list of QSslError::SslError values per certificate in the certificate chain.
85 * \since 5.65
86 */
87 static QList<QList<QSslError::SslError>> certificateErrorsFromString(const QString &errorsString);
88
89private:
90 KIOWIDGETS_NO_EXPORT void updateWhichPartsEncrypted();
91
92 class KSslInfoDialogPrivate;
93 std::unique_ptr<KSslInfoDialogPrivate> const d;
94
95private Q_SLOTS:
96 KIOWIDGETS_NO_EXPORT void displayFromChain(int);
97};
98
99#endif
100

source code of kio/src/widgets/ksslinfodialog.h