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 * KDE SSL Information Dialog
21 *
22 * This class creates a dialog that can be used to display information about
23 * an SSL session.
24 *
25 * There are NO GUARANTEES that KSslInfoDialog will remain binary compatible/
26 * Contact staikos@kde.org for details if needed.
27 *
28 * @author George Staikos <staikos@kde.org>
29 * @see KSSL
30 * @short KDE SSL Information Dialog
31 */
32class KIOWIDGETS_EXPORT KSslInfoDialog : public QDialog
33{
34 Q_OBJECT
35public:
36 /**
37 * Construct a KSSL Information Dialog
38 *
39 * @param parent the parent widget
40 */
41 explicit KSslInfoDialog(QWidget *parent = nullptr);
42
43 /**
44 * Destroy this dialog
45 */
46 ~KSslInfoDialog() override;
47
48 /**
49 * Set information to display about the SSL connection.
50 *
51 * @param certificateChain the certificate chain leading from the certificate
52 * authority to the peer.
53 * @param ip the ip of the remote host
54 * @param host the remote hostname
55 * @param sslProtocol the version of SSL in use (SSLv2, SSLv3, TLSv1)
56 * @param cipher the cipher in use
57 * @param usedBits the used bits of the key
58 * @param bits the key size of the cipher in use
59 * @param validationErrors errors validating the certificates, if any
60 * @since 5.64
61 */
62 void setSslInfo(const QList<QSslCertificate> &certificateChain,
63 const QString &ip,
64 const QString &host,
65 const QString &sslProtocol,
66 const QString &cipher,
67 int usedBits,
68 int bits,
69 const QList<QList<QSslError::SslError>> &validationErrors);
70
71 void setMainPartEncrypted(bool);
72 void setAuxiliaryPartsEncrypted(bool);
73
74 /**
75 * Converts certificate errors as provided in the "ssl_cert_errors" meta data
76 * to a list of QSslError::SslError values per certificate in the certificate chain.
77 * @since 5.65
78 */
79 static QList<QList<QSslError::SslError>> certificateErrorsFromString(const QString &errorsString);
80
81private:
82 KIOWIDGETS_NO_EXPORT void updateWhichPartsEncrypted();
83
84 class KSslInfoDialogPrivate;
85 std::unique_ptr<KSslInfoDialogPrivate> const d;
86
87private Q_SLOTS:
88 KIOWIDGETS_NO_EXPORT void displayFromChain(int);
89};
90
91#endif
92

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