11 try: |
11 try: |
12 str = unicode |
12 str = unicode |
13 except NameError: |
13 except NameError: |
14 pass |
14 pass |
15 |
15 |
16 from PyQt5.QtCore import pyqtSlot, Qt, QPointF, QUrl, QDateTime, qVersion |
16 from PyQt5.QtCore import pyqtSlot, Qt, QPointF, QUrl, QDateTime |
17 from PyQt5.QtGui import QColor, QPalette, QLinearGradient, QIcon |
17 from PyQt5.QtGui import QColor, QPalette, QLinearGradient, QIcon |
18 from PyQt5.QtWidgets import QDialog, QApplication |
18 from PyQt5.QtWidgets import QDialog, QApplication |
19 try: |
19 try: |
20 from PyQt5.QtNetwork import QSslCertificate # __IGNORE_EXCEPTION__ |
20 from PyQt5.QtNetwork import QSslCertificate # __IGNORE_EXCEPTION__ |
21 except ImportError: |
21 except ImportError: |
185 if ok and \ |
186 if ok and \ |
186 self.__browser.url().scheme() == "https" and \ |
187 self.__browser.url().scheme() == "https" and \ |
187 QSslCertificate is not None: |
188 QSslCertificate is not None: |
188 sslInfo = self.__browser.page().getSslCertificate() |
189 sslInfo = self.__browser.page().getSslCertificate() |
189 if sslInfo is not None: |
190 if sslInfo is not None: |
190 if qVersion() >= "5.0.0": |
191 if qVersionTuple() >= (5, 0, 0): |
191 org = Utilities.decodeString(", ".join( |
192 org = Utilities.decodeString(", ".join( |
192 sslInfo.subjectInfo(QSslCertificate.Organization))) |
193 sslInfo.subjectInfo(QSslCertificate.Organization))) |
193 else: |
194 else: |
194 org = Utilities.decodeString( |
195 org = Utilities.decodeString( |
195 sslInfo.subjectInfo(QSslCertificate.Organization)) |
196 sslInfo.subjectInfo(QSslCertificate.Organization)) |
196 if org == "": |
197 if org == "": |
197 if qVersion() >= "5.0.0": |
198 if qVersionTuple() >= (5, 0, 0): |
198 cn = Utilities.decodeString(", ".join( |
199 cn = Utilities.decodeString(", ".join( |
199 sslInfo.subjectInfo( |
200 sslInfo.subjectInfo( |
200 QSslCertificate.CommonName))) |
201 QSslCertificate.CommonName))) |
201 else: |
202 else: |
202 cn = Utilities.decodeString( |
203 cn = Utilities.decodeString( |
206 org = cn.split(".", 1)[1] |
207 org = cn.split(".", 1)[1] |
207 if org == "": |
208 if org == "": |
208 org = self.tr("Unknown") |
209 org = self.tr("Unknown") |
209 self.__sslLabel.setText(" {0} ".format(org)) |
210 self.__sslLabel.setText(" {0} ".format(org)) |
210 self.__sslLabel.setVisible(True) |
211 self.__sslLabel.setVisible(True) |
211 if qVersion() >= "5.0.0": |
212 if qVersionTuple() >= (5, 0, 0): |
212 valid = not sslInfo.isBlacklisted() |
213 valid = not sslInfo.isBlacklisted() |
213 else: |
214 else: |
214 valid = sslInfo.isValid() |
215 valid = sslInfo.isValid() |
215 if valid: |
216 if valid: |
216 config = self.__browser.page().getSslConfiguration() |
217 config = self.__browser.page().getSslConfiguration() |