From b35a4fec9deb1ccb23f5d9c5c943f956909267a1 Mon Sep 17 00:00:00 2001 From: Alberto Sottile Date: Fri, 15 Feb 2019 16:32:50 +0100 Subject: [PATCH] startTLS: add custom certificate info dialog --- resources/{green_lock.png => lock_green.png} | Bin resources/lock_green_dialog.png | Bin 0 -> 862 bytes syncplay/protocols.py | 18 ++++-- syncplay/ui/gui.py | 56 ++++++++++++++++--- 4 files changed, 59 insertions(+), 15 deletions(-) rename resources/{green_lock.png => lock_green.png} (100%) create mode 100644 resources/lock_green_dialog.png diff --git a/resources/green_lock.png b/resources/lock_green.png similarity index 100% rename from resources/green_lock.png rename to resources/lock_green.png diff --git a/resources/lock_green_dialog.png b/resources/lock_green_dialog.png new file mode 100644 index 0000000000000000000000000000000000000000..fc62b0514b6b4f766e983783ecfbd1d89fc40290 GIT binary patch literal 862 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I3?%1nZ+ru!n2Vh}LpV4%Za?&Y0OWEOctjR6 zFfeI=Fyo0kzl4B-k|nMYCBgY=CFO}lsSM@i<$9TU*~Q6;1*v-ZMd`EO*+>Bu{R!|1 zasB`QKf`~9hW`zrt3uPxq$TW6C_Dya_?GO9&DtNDbR;QlcWA->gv`TH*?Z!EB58+W za*jk~AC1b`ACY@BJpEu)&i=@(gW(zb!!r*>W*-XAJQAIAI3nvnRQAEB%!3ixK=z@C z?1Mn5sI0?4k;tq=QJIHtcG!}?}44?uK<1mB` zCc)xBEkKP>HDD2-jUe@eko7K51Ovx;)sI6;gY3rCVcfpe7Yqo6Lv1|9f1BXwXJb&Thm7BL; zy?OWk^OqmL{`~!S$-_pOfq}8q)5S3);_%yPnf`|y1lp!Mv*>Fqk|{dD%cWs1Ca9sn zv6S`O|Nr8L{ZPHiqRK){dj6rh5hyU z<$K=kYMsIDwQk0S)q7v)KMu^Cdivb@MVocBpR(`$+1*-{@bLZD4MiK|tN1_i)E3{j z`*60=X5({P?~K!bTqG5|`GY64tmEq~ZBU)rr1nzKQtGh_)9f>{hXl)BZt;F_=%7GB z!Sqn8wM(DT%y~k`osF*u8HT(uRUW8D(PM{DbtZN;^YSyncplay is using an encrypted connection to {}.".format(tlsData["subject"])) + descLabel = QtWidgets.QLabel("Encryption with a digital certificate keeps information private as it's sent to or from the
server {}.".format(tlsData["subject"])) + connDataLabel = QtWidgets.QLabel("Information encrypted using Transport Layer Security (TLS), version {} with the cipher
suite:{}.".format(tlsData["protocolVersion"], tlsData["cipher"])) + certDataLabel = QtWidgets.QLabel("Certificate issued by {} valid until {}.".format(tlsData["issuer"], tlsData["expires"])) + statusLabel.setFont(QtGui.QFont("Helvetica", 12)) + descLabel.setFont(QtGui.QFont("Helvetica", 12)) + connDataLabel.setFont(QtGui.QFont("Helvetica", 12)) + certDataLabel.setFont(QtGui.QFont("Helvetica", 12)) + lockIconPixmap = QtGui.QPixmap(resourcespath + "lock_green_dialog.png") + lockIconLabel = QtWidgets.QLabel() + lockIconLabel.setPixmap(lockIconPixmap.scaled(64, 64, Qt.KeepAspectRatio)) + certLayout = QtWidgets.QGridLayout() + certLayout.addWidget(lockIconLabel, 1, 0, 3, 1, Qt.AlignLeft | Qt.AlignTop) + certLayout.addWidget(statusLabel, 0, 1, 1, 3) + certLayout.addWidget(descLabel, 1, 1, 1, 3) + certLayout.addWidget(connDataLabel, 2, 1, 1, 3) + certLayout.addWidget(certDataLabel, 3, 1, 1, 3) + closeButton = QtWidgets.QPushButton("Close") + closeButton.setFixedWidth(100) + closeButton.setAutoDefault(False) + closeButton.clicked.connect(self.closeDialog) + certLayout.addWidget(closeButton, 4, 3, 1, 1) + certLayout.setVerticalSpacing(10) + certLayout.setSizeConstraint(QtWidgets.QLayout.SetFixedSize) + self.setSizeGripEnabled(False) + self.setLayout(certLayout) + + def closeDialog(self): + self.close() + + class MainWindow(QtWidgets.QMainWindow): insertPosition = None playlistState = [] @@ -1251,14 +1293,14 @@ class MainWindow(QtWidgets.QMainWindow): window.listlabel = QtWidgets.QLabel(getMessage("userlist-heading-label")) window.listlabel.setMinimumHeight(27) if isMacOS: - window.sslButton = QtWidgets.QPushButton(QtGui.QPixmap(resourcespath + 'green_lock.png').scaled(14, 14),"") + window.sslButton = QtWidgets.QPushButton(QtGui.QPixmap(resourcespath + 'lock_green.png').scaled(14, 14),"") window.sslButton.setVisible(False) window.sslButton.setFixedHeight(21) window.sslButton.setFixedWidth(21) window.sslButton.setMinimumSize(21, 21) window.sslButton.setStyleSheet("QPushButton:!hover{border: 1px solid gray;} QPushButton:hover{border:2px solid black;}") else: - window.sslButton = QtWidgets.QPushButton(QtGui.QPixmap(resourcespath + 'green_lock.png'),"") + window.sslButton = QtWidgets.QPushButton(QtGui.QPixmap(resourcespath + 'lock_green.png'),"") window.sslButton.setVisible(False) window.sslButton.setFixedHeight(27) window.sslButton.setFixedWidth(27) @@ -1540,13 +1582,9 @@ class MainWindow(QtWidgets.QMainWindow): @needsClient def openSSLDetails(self): - boxReturn = QtWidgets.QMessageBox.information( - self, - getMessage("ssl-information-title"), - "[{}]\n{}".format(getMessage("ssl-information-title"),self.getSSLInformation()) - ) - if(boxReturn): self.sslButton.setDown(False) - + sslDetailsBox = CertificateDialog(self.getSSLInformation()) + sslDetailsBox.exec_() + self.sslButton.setDown(False) def openAbout(self): aboutMsgBox = AboutDialog()