File indexing completed on 2023-11-26 07:34:15
0001 /* 0002 This file is part of the KDE project 0003 SPDX-FileCopyrightText: 2000-2003 George Staikos <staikos@kde.org> 0004 SPDX-FileCopyrightText: 2000 Malte Starostik <malte@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 0009 #ifndef _KSSLINFODIALOG_H 0010 #define _KSSLINFODIALOG_H 0011 0012 #include <QDialog> 0013 #include <QSslError> 0014 0015 #include "kiowidgets_export.h" 0016 #include "ktcpsocket.h" // TODO KF6 remove this include 0017 0018 #include <memory> 0019 0020 /** 0021 * KDE SSL Information Dialog 0022 * 0023 * This class creates a dialog that can be used to display information about 0024 * an SSL session. 0025 * 0026 * There are NO GUARANTEES that KSslInfoDialog will remain binary compatible/ 0027 * Contact staikos@kde.org for details if needed. 0028 * 0029 * @author George Staikos <staikos@kde.org> 0030 * @see KSSL 0031 * @short KDE SSL Information Dialog 0032 */ 0033 class KIOWIDGETS_EXPORT KSslInfoDialog : public QDialog 0034 { 0035 Q_OBJECT 0036 public: 0037 /** 0038 * Construct a KSSL Information Dialog 0039 * 0040 * @param parent the parent widget 0041 */ 0042 explicit KSslInfoDialog(QWidget *parent = nullptr); 0043 0044 /** 0045 * Destroy this dialog 0046 */ 0047 ~KSslInfoDialog() override; 0048 0049 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 64) 0050 /** 0051 * Set information to display about the SSL connection. 0052 * 0053 * @param certificateChain the certificate chain leading from the certificate 0054 * authority to the peer. 0055 * @param ip the ip of the remote host 0056 * @param host the remote hostname 0057 * @param sslProtocol the version of SSL in use (SSLv2, SSLv3, TLSv1) 0058 * @param cipher the cipher in use 0059 * @param usedBits the used bits of the key 0060 * @param bits the key size of the cipher in use 0061 * @param validationErrors errors validating the certificates, if any 0062 * @deprecated since 5.64, use the QSslError variant 0063 */ 0064 KIOCORE_DEPRECATED_VERSION(5, 64, "use the QSslError variant") 0065 void setSslInfo(const QList<QSslCertificate> &certificateChain, 0066 const QString &ip, 0067 const QString &host, 0068 const QString &sslProtocol, 0069 const QString &cipher, 0070 int usedBits, 0071 int bits, 0072 const QList<QList<KSslError::Error>> &validationErrors); // TODO KF6 remove 0073 #endif 0074 0075 /** 0076 * Set information to display about the SSL connection. 0077 * 0078 * @param certificateChain the certificate chain leading from the certificate 0079 * authority to the peer. 0080 * @param ip the ip of the remote host 0081 * @param host the remote hostname 0082 * @param sslProtocol the version of SSL in use (SSLv2, SSLv3, TLSv1) 0083 * @param cipher the cipher in use 0084 * @param usedBits the used bits of the key 0085 * @param bits the key size of the cipher in use 0086 * @param validationErrors errors validating the certificates, if any 0087 * @since 5.64 0088 */ 0089 void setSslInfo(const QList<QSslCertificate> &certificateChain, 0090 const QString &ip, 0091 const QString &host, 0092 const QString &sslProtocol, 0093 const QString &cipher, 0094 int usedBits, 0095 int bits, 0096 const QList<QList<QSslError::SslError>> &validationErrors); 0097 0098 void setMainPartEncrypted(bool); 0099 void setAuxiliaryPartsEncrypted(bool); 0100 0101 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 65) 0102 /** @deprecated since 5.65, use certificateErrorsFromString */ 0103 KIOCORE_DEPRECATED_VERSION(5, 65, "use the QSslError variant") 0104 static QList<QList<KSslError::Error>> errorsFromString(const QString &s); // TODO KF6 remove 0105 #endif 0106 /** 0107 * Converts certificate errors as provided in the "ssl_cert_errors" meta data 0108 * to a list of QSslError::SslError values per certificate in the certificate chain. 0109 * @since 5.65 0110 */ 0111 static QList<QList<QSslError::SslError>> certificateErrorsFromString(const QString &errorsString); 0112 0113 private: 0114 KIOWIDGETS_NO_EXPORT void updateWhichPartsEncrypted(); 0115 0116 class KSslInfoDialogPrivate; 0117 std::unique_ptr<KSslInfoDialogPrivate> const d; 0118 0119 private Q_SLOTS: 0120 KIOWIDGETS_NO_EXPORT void displayFromChain(int); 0121 }; 0122 0123 #endif