32 super(E5SslInfoWidget, self).__init__(parent) |
32 super(E5SslInfoWidget, self).__init__(parent) |
33 |
33 |
34 self.__url = QUrl(url) |
34 self.__url = QUrl(url) |
35 self.__configuration = QSslConfiguration(configuration) |
35 self.__configuration = QSslConfiguration(configuration) |
36 |
36 |
37 self.setAttribute(Qt.WA_DeleteOnClose) |
|
38 self.setMinimumWidth(400) |
37 self.setMinimumWidth(400) |
39 |
38 |
40 certList = self.__configuration.peerCertificateChain() |
39 certList = self.__configuration.peerCertificateChain() |
41 if certList: |
40 if certList: |
42 cert = certList[0] |
41 cert = certList[0] |
53 layout.addWidget(imageLabel, rows, 0, Qt.AlignCenter) |
52 layout.addWidget(imageLabel, rows, 0, Qt.AlignCenter) |
54 |
53 |
55 label = QLabel(self) |
54 label = QLabel(self) |
56 label.setWordWrap(True) |
55 label.setWordWrap(True) |
57 label.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) |
56 label.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) |
58 label.setText(self.trUtf8("Identity")) |
57 label.setText(self.tr("Identity")) |
59 font = label.font() |
58 font = label.font() |
60 font.setBold(True) |
59 font.setBold(True) |
61 label.setFont(font) |
60 label.setFont(font) |
62 layout.addWidget(label, rows, 1) |
61 layout.addWidget(label, rows, 1) |
63 rows += 1 |
62 rows += 1 |
64 |
63 |
65 label = QLabel(self) |
64 label = QLabel(self) |
66 label.setWordWrap(True) |
65 label.setWordWrap(True) |
67 if cert.isNull(): |
66 if cert.isNull(): |
68 label.setText(self.trUtf8( |
67 label.setText(self.tr( |
69 "Warning: this site is NOT carrying a certificate.")) |
68 "Warning: this site is NOT carrying a certificate.")) |
70 imageLabel.setPixmap(UI.PixmapCache.getPixmap("securityLow32.png")) |
69 imageLabel.setPixmap(UI.PixmapCache.getPixmap("securityLow32.png")) |
71 else: |
70 else: |
72 if qVersion() >= "5.0.0": |
71 if qVersion() >= "5.0.0": |
73 valid = not cert.isBlacklisted() |
72 valid = not cert.isBlacklisted() |
77 if qVersion() >= "5.0.0": |
76 if qVersion() >= "5.0.0": |
78 txt = ", ".join( |
77 txt = ", ".join( |
79 cert.issuerInfo(QSslCertificate.CommonName)) |
78 cert.issuerInfo(QSslCertificate.CommonName)) |
80 else: |
79 else: |
81 txt = cert.issuerInfo(QSslCertificate.CommonName) |
80 txt = cert.issuerInfo(QSslCertificate.CommonName) |
82 label.setText(self.trUtf8( |
81 label.setText(self.tr( |
83 "The certificate for this site is valid" |
82 "The certificate for this site is valid" |
84 " and has been verified by:\n{0}").format( |
83 " and has been verified by:\n{0}").format( |
85 Utilities.decodeString(txt))) |
84 Utilities.decodeString(txt))) |
86 imageLabel.setPixmap( |
85 imageLabel.setPixmap( |
87 UI.PixmapCache.getPixmap("securityHigh32.png")) |
86 UI.PixmapCache.getPixmap("securityHigh32.png")) |
88 else: |
87 else: |
89 label.setText(self.trUtf8( |
88 label.setText(self.tr( |
90 "The certificate for this site is NOT valid.")) |
89 "The certificate for this site is NOT valid.")) |
91 imageLabel.setPixmap( |
90 imageLabel.setPixmap( |
92 UI.PixmapCache.getPixmap("securityLow32.png")) |
91 UI.PixmapCache.getPixmap("securityLow32.png")) |
93 layout.addWidget(label, rows, 1) |
92 layout.addWidget(label, rows, 1) |
94 rows += 1 |
93 rows += 1 |
95 |
94 |
96 label = QLabel(self) |
95 label = QLabel(self) |
97 label.setWordWrap(True) |
96 label.setWordWrap(True) |
98 label.setText( |
97 label.setText( |
99 '<a href="moresslinfos">' + |
98 '<a href="moresslinfos">' + |
100 self.trUtf8("Certificate Information") + "</a>") |
99 self.tr("Certificate Information") + "</a>") |
101 label.linkActivated.connect(self.__showCertificateInfos) |
100 label.linkActivated.connect(self.__showCertificateInfos) |
102 layout.addWidget(label, rows, 1) |
101 layout.addWidget(label, rows, 1) |
103 rows += 1 |
102 rows += 1 |
104 |
103 |
105 ########################################## |
104 ########################################## |
108 imageLabel = QLabel(self) |
107 imageLabel = QLabel(self) |
109 layout.addWidget(imageLabel, rows, 0, Qt.AlignCenter) |
108 layout.addWidget(imageLabel, rows, 0, Qt.AlignCenter) |
110 |
109 |
111 label = QLabel(self) |
110 label = QLabel(self) |
112 label.setWordWrap(True) |
111 label.setWordWrap(True) |
113 label.setText(self.trUtf8("Encryption")) |
112 label.setText(self.tr("Encryption")) |
114 font = label.font() |
113 font = label.font() |
115 font.setBold(True) |
114 font.setBold(True) |
116 label.setFont(font) |
115 label.setFont(font) |
117 layout.addWidget(label, rows, 1) |
116 layout.addWidget(label, rows, 1) |
118 rows += 1 |
117 rows += 1 |
119 |
118 |
120 cipher = self.__configuration.sessionCipher() |
119 cipher = self.__configuration.sessionCipher() |
121 if cipher.isNull(): |
120 if cipher.isNull(): |
122 label = QLabel(self) |
121 label = QLabel(self) |
123 label.setWordWrap(True) |
122 label.setWordWrap(True) |
124 label.setText(self.trUtf8( |
123 label.setText(self.tr( |
125 'Your connection to "{0}" is NOT encrypted.\n').format( |
124 'Your connection to "{0}" is NOT encrypted.\n').format( |
126 self.__url.host())) |
125 self.__url.host())) |
127 layout.addWidget(label, rows, 1) |
126 layout.addWidget(label, rows, 1) |
128 imageLabel.setPixmap(UI.PixmapCache.getPixmap("securityLow32.png")) |
127 imageLabel.setPixmap(UI.PixmapCache.getPixmap("securityLow32.png")) |
129 rows += 1 |
128 rows += 1 |
130 else: |
129 else: |
131 label = QLabel(self) |
130 label = QLabel(self) |
132 label.setWordWrap(True) |
131 label.setWordWrap(True) |
133 label.setText(self.trUtf8( |
132 label.setText(self.tr( |
134 'Your connection to "{0}" is encrypted.').format( |
133 'Your connection to "{0}" is encrypted.').format( |
135 self.__url.host())) |
134 self.__url.host())) |
136 layout.addWidget(label, rows, 1) |
135 layout.addWidget(label, rows, 1) |
137 |
136 |
138 proto = cipher.protocol() |
137 proto = cipher.protocol() |
147 elif proto == QSsl.SslV2: |
146 elif proto == QSsl.SslV2: |
148 sslVersion = "SSL 2.0" |
147 sslVersion = "SSL 2.0" |
149 imageLabel.setPixmap( |
148 imageLabel.setPixmap( |
150 UI.PixmapCache.getPixmap("securityLow32.png")) |
149 UI.PixmapCache.getPixmap("securityLow32.png")) |
151 else: |
150 else: |
152 sslVersion = self.trUtf8("unknown") |
151 sslVersion = self.tr("unknown") |
153 imageLabel.setPixmap( |
152 imageLabel.setPixmap( |
154 UI.PixmapCache.getPixmap("securityLow32.png")) |
153 UI.PixmapCache.getPixmap("securityLow32.png")) |
155 rows += 1 |
154 rows += 1 |
156 |
155 |
157 label = QLabel(self) |
156 label = QLabel(self) |
158 label.setWordWrap(True) |
157 label.setWordWrap(True) |
159 label.setText(self.trUtf8( |
158 label.setText(self.tr( |
160 "It uses protocol: {0}").format(sslVersion)) |
159 "It uses protocol: {0}").format(sslVersion)) |
161 layout.addWidget(label, rows, 1) |
160 layout.addWidget(label, rows, 1) |
162 rows += 1 |
161 rows += 1 |
163 |
162 |
164 label = QLabel(self) |
163 label = QLabel(self) |
165 label.setWordWrap(True) |
164 label.setWordWrap(True) |
166 label.setText(self.trUtf8( |
165 label.setText(self.tr( |
167 "It is encrypted using {0} at {1} bits, " |
166 "It is encrypted using {0} at {1} bits, " |
168 "with {2} for message authentication and " |
167 "with {2} for message authentication and " |
169 "{3} as key exchange mechanism.\n\n").format( |
168 "{3} as key exchange mechanism.\n\n").format( |
170 cipher.encryptionMethod(), |
169 cipher.encryptionMethod(), |
171 cipher.usedBits(), |
170 cipher.usedBits(), |