eric6/E5Network/E5SslInfoWidget.py

changeset 7533
88261c96484b
parent 7360
9190402e4505
child 7759
51aa6c6b66f7
equal deleted inserted replaced
7532:1358e9d67a1c 7533:88261c96484b
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(self.tr( 66 label.setText(self.tr(
67 "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"))
69 else: 69 else:
70 valid = not cert.isBlacklisted() 70 valid = not cert.isBlacklisted()
71 if valid: 71 if valid:
72 txt = ", ".join( 72 txt = ", ".join(
73 cert.issuerInfo(QSslCertificate.CommonName)) 73 cert.issuerInfo(QSslCertificate.CommonName))
74 label.setText(self.tr( 74 label.setText(self.tr(
75 "The certificate for this site is valid" 75 "The certificate for this site is valid"
76 " and has been verified by:\n{0}").format( 76 " and has been verified by:\n{0}").format(
77 Utilities.decodeString(txt))) 77 Utilities.decodeString(txt)))
78 imageLabel.setPixmap( 78 imageLabel.setPixmap(
79 UI.PixmapCache.getPixmap("securityHigh32.png")) 79 UI.PixmapCache.getPixmap("securityHigh32"))
80 else: 80 else:
81 label.setText(self.tr( 81 label.setText(self.tr(
82 "The certificate for this site is NOT valid.")) 82 "The certificate for this site is NOT valid."))
83 imageLabel.setPixmap( 83 imageLabel.setPixmap(
84 UI.PixmapCache.getPixmap("securityLow32.png")) 84 UI.PixmapCache.getPixmap("securityLow32"))
85 layout.addWidget(label, rows, 1) 85 layout.addWidget(label, rows, 1)
86 rows += 1 86 rows += 1
87 87
88 label = QLabel(self) 88 label = QLabel(self)
89 label.setWordWrap(True) 89 label.setWordWrap(True)
115 label.setWordWrap(True) 115 label.setWordWrap(True)
116 label.setText(self.tr( 116 label.setText(self.tr(
117 'Your connection to "{0}" is NOT encrypted.\n').format( 117 'Your connection to "{0}" is NOT encrypted.\n').format(
118 self.__url.host())) 118 self.__url.host()))
119 layout.addWidget(label, rows, 1) 119 layout.addWidget(label, rows, 1)
120 imageLabel.setPixmap(UI.PixmapCache.getPixmap("securityLow32.png")) 120 imageLabel.setPixmap(UI.PixmapCache.getPixmap("securityLow32"))
121 rows += 1 121 rows += 1
122 else: 122 else:
123 label = QLabel(self) 123 label = QLabel(self)
124 label.setWordWrap(True) 124 label.setWordWrap(True)
125 label.setText(self.tr( 125 label.setText(self.tr(
129 129
130 proto = cipher.protocol() 130 proto = cipher.protocol()
131 if proto == QSsl.SslV3: 131 if proto == QSsl.SslV3:
132 sslVersion = "SSL 3.0" 132 sslVersion = "SSL 3.0"
133 imageLabel.setPixmap( 133 imageLabel.setPixmap(
134 UI.PixmapCache.getPixmap("securityLow32.png")) 134 UI.PixmapCache.getPixmap("securityLow32"))
135 elif proto == QSsl.TlsV1SslV3: 135 elif proto == QSsl.TlsV1SslV3:
136 sslVersion = "TLS 1.0/SSL 3.0" 136 sslVersion = "TLS 1.0/SSL 3.0"
137 imageLabel.setPixmap( 137 imageLabel.setPixmap(
138 UI.PixmapCache.getPixmap("securityLow32.png")) 138 UI.PixmapCache.getPixmap("securityLow32"))
139 elif proto == QSsl.SslV2: 139 elif proto == QSsl.SslV2:
140 sslVersion = "SSL 2.0" 140 sslVersion = "SSL 2.0"
141 imageLabel.setPixmap( 141 imageLabel.setPixmap(
142 UI.PixmapCache.getPixmap("securityLow32.png")) 142 UI.PixmapCache.getPixmap("securityLow32"))
143 else: 143 else:
144 sslVersion = self.tr("unknown") 144 sslVersion = self.tr("unknown")
145 imageLabel.setPixmap( 145 imageLabel.setPixmap(
146 UI.PixmapCache.getPixmap("securityLow32.png")) 146 UI.PixmapCache.getPixmap("securityLow32"))
147 if proto == QSsl.TlsV1_0: 147 if proto == QSsl.TlsV1_0:
148 sslVersion = "TLS 1.0" 148 sslVersion = "TLS 1.0"
149 imageLabel.setPixmap( 149 imageLabel.setPixmap(
150 UI.PixmapCache.getPixmap("securityHigh32.png")) 150 UI.PixmapCache.getPixmap("securityHigh32"))
151 elif proto == QSsl.TlsV1_1: 151 elif proto == QSsl.TlsV1_1:
152 sslVersion = "TLS 1.1" 152 sslVersion = "TLS 1.1"
153 imageLabel.setPixmap( 153 imageLabel.setPixmap(
154 UI.PixmapCache.getPixmap("securityHigh32.png")) 154 UI.PixmapCache.getPixmap("securityHigh32"))
155 elif proto == QSsl.TlsV1_2: 155 elif proto == QSsl.TlsV1_2:
156 sslVersion = "TLS 1.2" 156 sslVersion = "TLS 1.2"
157 imageLabel.setPixmap( 157 imageLabel.setPixmap(
158 UI.PixmapCache.getPixmap("securityHigh32.png")) 158 UI.PixmapCache.getPixmap("securityHigh32"))
159 try: 159 try:
160 # Qt 5.12 and newer 160 # Qt 5.12 and newer
161 if proto == QSsl.TlsV1_2: 161 if proto == QSsl.TlsV1_2:
162 sslVersion = "TLS 1.2" 162 sslVersion = "TLS 1.2"
163 imageLabel.setPixmap( 163 imageLabel.setPixmap(
164 UI.PixmapCache.getPixmap("securityHigh32.png")) 164 UI.PixmapCache.getPixmap("securityHigh32"))
165 except AttributeError: 165 except AttributeError:
166 pass 166 pass
167 rows += 1 167 rows += 1
168 168
169 label = QLabel(self) 169 label = QLabel(self)

eric ide

mercurial