Helpviewer/SslInfoDialog.py

changeset 1367
a652a6794953
parent 1341
6104ae9ceb55
child 1427
09d6731b73ad
equal deleted inserted replaced
1366:f2e7957924cb 1367:a652a6794953
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, QDateTime 10 from PyQt4.QtCore import QCryptographicHash, QDateTime, 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
48 certificate.issuerInfo(QSslCertificate.CommonName))) 48 certificate.issuerInfo(QSslCertificate.CommonName)))
49 self.issuerOrganizationLabel.setText(self.__certificateString( 49 self.issuerOrganizationLabel.setText(self.__certificateString(
50 certificate.issuerInfo(QSslCertificate.Organization))) 50 certificate.issuerInfo(QSslCertificate.Organization)))
51 self.issuerOrganizationalUnitLabel.setText(self.__certificateString( 51 self.issuerOrganizationalUnitLabel.setText(self.__certificateString(
52 certificate.issuerInfo(QSslCertificate.OrganizationalUnitName))) 52 certificate.issuerInfo(QSslCertificate.OrganizationalUnitName)))
53 self.effectiveLabel.setText(certificate.effectiveDate().toString("yyyy-MM-dd")) 53 self.effectiveLabel.setText(Qt.escape(
54 self.expiresLabel.setText(certificate.expiryDate().toString("yyyy-MM-dd")) 54 certificate.effectiveDate().toString("yyyy-MM-dd")))
55 self.expiresLabel.setText(Qt.escape(
56 certificate.expiryDate().toString("yyyy-MM-dd")))
55 self.sha1Label.setText(self.__formatHexString( 57 self.sha1Label.setText(self.__formatHexString(
56 str(certificate.digest(QCryptographicHash.Sha1).toHex(), encoding="ascii"))) 58 str(certificate.digest(QCryptographicHash.Sha1).toHex(), encoding="ascii")))
57 self.md5Label.setText(self.__formatHexString( 59 self.md5Label.setText(self.__formatHexString(
58 str(certificate.digest(QCryptographicHash.Md5).toHex(), encoding="ascii"))) 60 str(certificate.digest(QCryptographicHash.Md5).toHex(), encoding="ascii")))
59 61
72 @return prepared text (string) 74 @return prepared text (string)
73 """ 75 """
74 if txt is None or txt == "": 76 if txt is None or txt == "":
75 return self.trUtf8("<not part of the certificate>") 77 return self.trUtf8("<not part of the certificate>")
76 78
77 return Utilities.decodeString(txt) 79 return Qt.escape(Utilities.decodeString(txt))
78 80
79 def __serialNumber(self, cert): 81 def __serialNumber(self, cert):
80 """ 82 """
81 Private slot to format the certificate serial number. 83 Private slot to format the certificate serial number.
82 84
108 hexList = [] 110 hexList = []
109 while hexString: 111 while hexString:
110 hexList.append(hexString[:2]) 112 hexList.append(hexString[:2])
111 hexString = hexString[2:] 113 hexString = hexString[2:]
112 114
113 return ':'.join(hexList) 115 return Qt.escape(':'.join(hexList))
114 116
115 def __hasExpired(self, effectiveDate, expiryDate): 117 def __hasExpired(self, effectiveDate, expiryDate):
116 """ 118 """
117 Private method to check for a certificate expiration. 119 Private method to check for a certificate expiration.
118 120

eric ide

mercurial