5 |
5 |
6 """ |
6 """ |
7 Module implementing a dialog to show SSL certificate infos. |
7 Module implementing a dialog to show SSL certificate infos. |
8 """ |
8 """ |
9 |
9 |
10 from PyQt4.QtCore import QCryptographicHash |
10 from PyQt4.QtCore import QCryptographicHash, Qt |
11 from PyQt4.QtGui import QDialog |
11 from PyQt4.QtGui import QDialog |
12 from PyQt4.QtNetwork import QSslCertificate |
12 from PyQt4.QtNetwork import QSslCertificate |
13 |
13 |
14 from .Ui_SslInfoDialog import Ui_SslInfoDialog |
14 from .Ui_SslInfoDialog import Ui_SslInfoDialog |
15 |
15 |
40 certificate.issuerInfo(QSslCertificate.CommonName))) |
40 certificate.issuerInfo(QSslCertificate.CommonName))) |
41 self.issuerOrganizationLabel.setText(self.__certificateString( |
41 self.issuerOrganizationLabel.setText(self.__certificateString( |
42 certificate.issuerInfo(QSslCertificate.Organization))) |
42 certificate.issuerInfo(QSslCertificate.Organization))) |
43 self.issuerOrganizationalUnitLabel.setText(self.__certificateString( |
43 self.issuerOrganizationalUnitLabel.setText(self.__certificateString( |
44 certificate.issuerInfo(QSslCertificate.OrganizationalUnitName))) |
44 certificate.issuerInfo(QSslCertificate.OrganizationalUnitName))) |
45 self.effectiveLabel.setText(certificate.effectiveDate().toString("yyyy-MM-dd")) |
45 self.effectiveLabel.setText(Qt.escape( |
46 self.expiresLabel.setText(certificate.expiryDate().toString("yyyy-MM-dd")) |
46 certificate.effectiveDate().toString("yyyy-MM-dd"))) |
|
47 self.expiresLabel.setText(Qt.escape( |
|
48 certificate.expiryDate().toString("yyyy-MM-dd"))) |
47 self.sha1Label.setText(self.__formatHexString( |
49 self.sha1Label.setText(self.__formatHexString( |
48 str(certificate.digest(QCryptographicHash.Sha1).toHex(), encoding = "ascii"))) |
50 str(certificate.digest(QCryptographicHash.Sha1).toHex(), encoding = "ascii"))) |
49 self.md5Label.setText(self.__formatHexString( |
51 self.md5Label.setText(self.__formatHexString( |
50 str(certificate.digest(QCryptographicHash.Md5).toHex(), encoding = "ascii"))) |
52 str(certificate.digest(QCryptographicHash.Md5).toHex(), encoding = "ascii"))) |
51 |
53 |
57 @return prepared text (string) |
59 @return prepared text (string) |
58 """ |
60 """ |
59 if txt is None or txt == "": |
61 if txt is None or txt == "": |
60 return self.trUtf8("<not part of the certificate>") |
62 return self.trUtf8("<not part of the certificate>") |
61 |
63 |
62 return Utilities.decodeString(txt) |
64 return Qt.escape(Utilities.decodeString(txt)) |
63 |
65 |
64 def __serialNumber(self, cert): |
66 def __serialNumber(self, cert): |
65 """ |
67 """ |
66 Private slot to format the certificate serial number. |
68 Private slot to format the certificate serial number. |
67 |
69 |