E5Network/E5SslInfoWidget.py

changeset 2990
583beaf0b4b8
parent 2666
a9d0feafa87b
child 3022
57179e4cdadd
child 3057
10516539f238
equal deleted inserted replaced
2989:7efa8b8b6903 2990:583beaf0b4b8
61 rows += 1 61 rows += 1
62 62
63 label = QLabel(self) 63 label = QLabel(self)
64 label.setWordWrap(True) 64 label.setWordWrap(True)
65 if cert.isNull(): 65 if cert.isNull():
66 label.setText( 66 label.setText(self.trUtf8(
67 self.trUtf8("Warning: this site is NOT carrying a certificate.")) 67 "Warning: this site is NOT carrying a certificate."))
68 imageLabel.setPixmap(UI.PixmapCache.getPixmap("securityLow32.png")) 68 imageLabel.setPixmap(UI.PixmapCache.getPixmap("securityLow32.png"))
69 else: 69 else:
70 if qVersion() >= "5.0.0": 70 if qVersion() >= "5.0.0":
71 valid = not cert.isBlacklisted() 71 valid = not cert.isBlacklisted()
72 else: 72 else:
73 valid = cert.isValid() 73 valid = cert.isValid()
74 if valid: 74 if valid:
75 if qVersion() >= "5.0.0": 75 if qVersion() >= "5.0.0":
76 txt = ", ".join(cert.issuerInfo(QSslCertificate.CommonName)) 76 txt = ", ".join(
77 cert.issuerInfo(QSslCertificate.CommonName))
77 else: 78 else:
78 txt = cert.issuerInfo(QSslCertificate.CommonName) 79 txt = cert.issuerInfo(QSslCertificate.CommonName)
79 label.setText(self.trUtf8("The certificate for this site is valid" 80 label.setText(self.trUtf8(
81 "The certificate for this site is valid"
80 " and has been verified by:\n{0}").format( 82 " and has been verified by:\n{0}").format(
81 Utilities.decodeString(txt))) 83 Utilities.decodeString(txt)))
82 imageLabel.setPixmap(UI.PixmapCache.getPixmap("securityHigh32.png")) 84 imageLabel.setPixmap(
85 UI.PixmapCache.getPixmap("securityHigh32.png"))
83 else: 86 else:
84 label.setText(self.trUtf8("The certificate for this site is NOT valid.")) 87 label.setText(self.trUtf8(
85 imageLabel.setPixmap(UI.PixmapCache.getPixmap("securityLow32.png")) 88 "The certificate for this site is NOT valid."))
89 imageLabel.setPixmap(
90 UI.PixmapCache.getPixmap("securityLow32.png"))
86 layout.addWidget(label, rows, 1) 91 layout.addWidget(label, rows, 1)
87 rows += 1 92 rows += 1
88 93
89 label = QLabel(self) 94 label = QLabel(self)
90 label.setWordWrap(True) 95 label.setWordWrap(True)
128 layout.addWidget(label, rows, 1) 133 layout.addWidget(label, rows, 1)
129 134
130 proto = cipher.protocol() 135 proto = cipher.protocol()
131 if proto == QSsl.SslV3: 136 if proto == QSsl.SslV3:
132 sslVersion = "SSL 3.0" 137 sslVersion = "SSL 3.0"
133 imageLabel.setPixmap(UI.PixmapCache.getPixmap("securityHigh32.png")) 138 imageLabel.setPixmap(
139 UI.PixmapCache.getPixmap("securityHigh32.png"))
134 elif proto == QSsl.TlsV1: 140 elif proto == QSsl.TlsV1:
135 sslVersion = "TLS 1.0" 141 sslVersion = "TLS 1.0"
136 imageLabel.setPixmap(UI.PixmapCache.getPixmap("securityHigh32.png")) 142 imageLabel.setPixmap(
143 UI.PixmapCache.getPixmap("securityHigh32.png"))
137 elif proto == QSsl.SslV2: 144 elif proto == QSsl.SslV2:
138 sslVersion = "SSL 2.0" 145 sslVersion = "SSL 2.0"
139 imageLabel.setPixmap(UI.PixmapCache.getPixmap("securityLow32.png")) 146 imageLabel.setPixmap(
147 UI.PixmapCache.getPixmap("securityLow32.png"))
140 else: 148 else:
141 sslVersion = self.trUtf8("unknown") 149 sslVersion = self.trUtf8("unknown")
142 imageLabel.setPixmap(UI.PixmapCache.getPixmap("securityLow32.png")) 150 imageLabel.setPixmap(
143 rows += 1 151 UI.PixmapCache.getPixmap("securityLow32.png"))
144 152 rows += 1
145 label = QLabel(self) 153
146 label.setWordWrap(True) 154 label = QLabel(self)
147 label.setText(self.trUtf8("It uses protocol: {0}").format(sslVersion)) 155 label.setWordWrap(True)
156 label.setText(self.trUtf8(
157 "It uses protocol: {0}").format(sslVersion))
148 layout.addWidget(label, rows, 1) 158 layout.addWidget(label, rows, 1)
149 rows += 1 159 rows += 1
150 160
151 label = QLabel(self) 161 label = QLabel(self)
152 label.setWordWrap(True) 162 label.setWordWrap(True)
178 def __showCertificateInfos(self): 188 def __showCertificateInfos(self):
179 """ 189 """
180 Private slot to show certificate information. 190 Private slot to show certificate information.
181 """ 191 """
182 from .E5SslCertificatesInfoDialog import E5SslCertificatesInfoDialog 192 from .E5SslCertificatesInfoDialog import E5SslCertificatesInfoDialog
183 dlg = E5SslCertificatesInfoDialog(self.__configuration.peerCertificateChain()) 193 dlg = E5SslCertificatesInfoDialog(
194 self.__configuration.peerCertificateChain())
184 dlg.exec_() 195 dlg.exec_()
185 196
186 def accept(self): 197 def accept(self):
187 """ 198 """
188 Public method to accept the widget. 199 Public method to accept the widget.

eric ide

mercurial