1 // Copyright 2005-2019 The Mumble Developers. All rights reserved.
2 // Use of this source code is governed by a BSD-style license
3 // that can be found in the LICENSE file at the root of the
4 // Mumble source tree or at <https://www.mumble.info/LICENSE>.
5 
6 #ifndef MUMBLE_MUMBLE_CERT_H_
7 #define MUMBLE_MUMBLE_CERT_H_
8 
9 #include <QtCore/QtGlobal>
10 #include <QtCore/QString>
11 #if QT_VERSION >= 0x050000
12 # include <QtWidgets/QGroupBox>
13 #else
14 # include <QtGui/QGroupBox>
15 #endif
16 
17 #include <QtNetwork/QHostInfo>
18 #include <QtNetwork/QSslCertificate>
19 
20 #include "Settings.h"
21 
22 class QLabel;
23 class QWidget;
24 
25 class CertView : public QGroupBox {
26 	private:
27 		Q_OBJECT
28 		Q_DISABLE_COPY(CertView)
29 	protected:
30 		QList<QSslCertificate> qlCert;
31 		QLabel *qlSubjectName, *qlSubjectEmail, *qlIssuerName, *qlExpiry;
32 	public:
33 		CertView(QWidget *p);
34 		void setCert(const QList<QSslCertificate> &cert);
35 };
36 
37 #include "ui_Cert.h"
38 
39 class CertWizard : public QWizard, public Ui::Certificates {
40 	private:
41 		Q_OBJECT
42 		Q_DISABLE_COPY(CertWizard)
43 	protected:
44 		Settings::KeyPair kpCurrent, kpNew;
45 	public:
46 		CertWizard(QWidget *p = NULL);
47 		int nextId() const Q_DECL_OVERRIDE;
48 		void initializePage(int) Q_DECL_OVERRIDE;
49 		bool validateCurrentPage() Q_DECL_OVERRIDE;
50 		static bool validateCert(const Settings::KeyPair &);
51 		static Settings::KeyPair generateNewCert(QString name = QString(), const QString &email = QString());
52 		static QByteArray exportCert(const Settings::KeyPair &cert);
53 		static Settings::KeyPair importCert(QByteArray, const QString & = QString());
54 	public slots:
55 		void on_qleEmail_textChanged(const QString &);
56 		void on_qpbExportFile_clicked();
57 		void on_qleExportFile_textChanged(const QString &);
58 		void on_qpbImportFile_clicked();
59 		void on_qleImportFile_textChanged(const QString &);
60 		void on_qlePassword_textChanged(const QString &);
61 		void on_qlIntroText_linkActivated(const QString &);
62 };
63 
64 #endif
65