40 "QLabel { color : white; background-color : red; }") |
40 "QLabel { color : white; background-color : red; }") |
41 self.expiredLabel.setVisible(False) |
41 self.expiredLabel.setVisible(False) |
42 self.expiredLabel.setStyleSheet( |
42 self.expiredLabel.setStyleSheet( |
43 "QLabel { color : white; background-color : red; }") |
43 "QLabel { color : white; background-color : red; }") |
44 |
44 |
45 self.subjectCommonNameLabel.setText(self.__certificateString( |
45 if qVersion() >= "5.0.0": |
46 certificate.subjectInfo(QSslCertificate.CommonName))) |
46 self.subjectCommonNameLabel.setText(self.__certificateString( |
47 self.subjectOrganizationLabel.setText(self.__certificateString( |
47 ", ".join(certificate.subjectInfo(QSslCertificate.CommonName)))) |
48 certificate.subjectInfo(QSslCertificate.Organization))) |
48 self.subjectOrganizationLabel.setText(self.__certificateString( |
49 self.subjectOrganizationalUnitLabel.setText(self.__certificateString( |
49 ", ".join(certificate.subjectInfo(QSslCertificate.Organization)))) |
50 certificate.subjectInfo(QSslCertificate.OrganizationalUnitName))) |
50 self.subjectOrganizationalUnitLabel.setText(self.__certificateString( |
|
51 ", ".join( |
|
52 certificate.subjectInfo(QSslCertificate.OrganizationalUnitName)))) |
|
53 self.issuerCommonNameLabel.setText(self.__certificateString( |
|
54 ", ".join(certificate.issuerInfo(QSslCertificate.CommonName)))) |
|
55 self.issuerOrganizationLabel.setText(self.__certificateString( |
|
56 ", ".join(certificate.issuerInfo(QSslCertificate.Organization)))) |
|
57 self.issuerOrganizationalUnitLabel.setText(self.__certificateString( |
|
58 ", ".join(certificate.issuerInfo(QSslCertificate.OrganizationalUnitName)))) |
|
59 else: |
|
60 self.subjectCommonNameLabel.setText(self.__certificateString( |
|
61 certificate.subjectInfo(QSslCertificate.CommonName))) |
|
62 self.subjectOrganizationLabel.setText(self.__certificateString( |
|
63 certificate.subjectInfo(QSslCertificate.Organization))) |
|
64 self.subjectOrganizationalUnitLabel.setText(self.__certificateString( |
|
65 certificate.subjectInfo(QSslCertificate.OrganizationalUnitName))) |
|
66 self.issuerCommonNameLabel.setText(self.__certificateString( |
|
67 certificate.issuerInfo(QSslCertificate.CommonName))) |
|
68 self.issuerOrganizationLabel.setText(self.__certificateString( |
|
69 certificate.issuerInfo(QSslCertificate.Organization))) |
|
70 self.issuerOrganizationalUnitLabel.setText(self.__certificateString( |
|
71 certificate.issuerInfo(QSslCertificate.OrganizationalUnitName))) |
51 self.serialNumberLabel.setText(self.__serialNumber(certificate)) |
72 self.serialNumberLabel.setText(self.__serialNumber(certificate)) |
52 self.issuerCommonNameLabel.setText(self.__certificateString( |
|
53 certificate.issuerInfo(QSslCertificate.CommonName))) |
|
54 self.issuerOrganizationLabel.setText(self.__certificateString( |
|
55 certificate.issuerInfo(QSslCertificate.Organization))) |
|
56 self.issuerOrganizationalUnitLabel.setText(self.__certificateString( |
|
57 certificate.issuerInfo(QSslCertificate.OrganizationalUnitName))) |
|
58 self.effectiveLabel.setText(Qt.escape( |
73 self.effectiveLabel.setText(Qt.escape( |
59 certificate.effectiveDate().toString("yyyy-MM-dd"))) |
74 certificate.effectiveDate().toString("yyyy-MM-dd"))) |
60 self.expiresLabel.setText(Qt.escape( |
75 self.expiresLabel.setText(Qt.escape( |
61 certificate.expiryDate().toString("yyyy-MM-dd"))) |
76 certificate.expiryDate().toString("yyyy-MM-dd"))) |
62 self.sha1Label.setText(self.__formatHexString( |
77 self.sha1Label.setText(self.__formatHexString( |
63 str(certificate.digest(QCryptographicHash.Sha1).toHex(), encoding="ascii"))) |
78 str(certificate.digest(QCryptographicHash.Sha1).toHex(), encoding="ascii"))) |
64 self.md5Label.setText(self.__formatHexString( |
79 self.md5Label.setText(self.__formatHexString( |
65 str(certificate.digest(QCryptographicHash.Md5).toHex(), encoding="ascii"))) |
80 str(certificate.digest(QCryptographicHash.Md5).toHex(), encoding="ascii"))) |
66 |
81 |
67 if not certificate.isValid(): |
82 if (qVersion() >= "5.0.0" and certificate.isBlacklisted()) or \ |
|
83 (qVersion() < "5.0.0" and not certificate.isValid()): |
68 # something is wrong; indicate it to the user |
84 # something is wrong; indicate it to the user |
69 if self.__hasExpired(certificate.effectiveDate(), certificate.expiryDate()): |
85 if self.__hasExpired(certificate.effectiveDate(), certificate.expiryDate()): |
70 self.expiredLabel.setVisible(True) |
86 self.expiredLabel.setVisible(True) |
71 else: |
87 else: |
72 self.blacklistedLabel.setVisible(True) |
88 self.blacklistedLabel.setVisible(True) |