/*! @file @id $Id$ */ // 1 2 3 4 5 6 7 8 // 45678901234567890123456789012345678901234567890123456789012345678901234567890 #ifndef CERTIFICATE_HXX #define CERTIFICATE_HXX #include #include #include #include #include #include class Certificate: public QWidget, protected Ui::Certificate { public: Certificate(QWidget* p): QWidget(p) { setupUi(this); } Certificate& certificate(const QSslCertificate& cert) { _cert->clear(); if (!cert.isValid()) return *this; _cert->addTopLevelItem ((new QTreeWidgetItem (QStringList()<addTopLevelItem ((new QTreeWidgetItem (QStringList()<addTopLevelItem ((new QTreeWidgetItem (QStringList()<addTopLevelItem ((new QTreeWidgetItem (QStringList()<addTopLevelItem // ((new QTreeWidgetItem // (QStringList()<addTopLevelItem ((it = new QTreeWidgetItem(QStringList()<=QSslCertificate::Organization; si=(QSslCertificate::SubjectInfo)((int)si-1)) if (!cert.subjectInfo(si).isEmpty()) it->addChild ((new QTreeWidgetItem (QStringList()<addChild ((it2 = new QTreeWidgetItem (QStringList()< asns(cert.alternateSubjectNames()); for (QMultiMap::iterator asn(asns.begin()); asn!=asns.end(); ++asn) it2->addChild ((new QTreeWidgetItem (QStringList()<addTopLevelItem ((it = new QTreeWidgetItem(QStringList()<=QSslCertificate::Organization; si=(QSslCertificate::SubjectInfo)((int)si-1)) if (!cert.issuerInfo(si).isEmpty()) it->addChild ((new QTreeWidgetItem (QStringList()<expandAll(); _cert->resizeColumnToContents(0); _cert->resizeColumnToContents(1); return *this; } QString alternateName(QSsl::AlternateNameEntryType an) { switch (an) { case QSsl::EmailEntry: return tr("E-Mail"); case QSsl::DnsEntry: return tr("URL"); } return tr("error", "unknown certificate subject alternate name"); } QString subjectInfo(QSslCertificate::SubjectInfo si) { switch (si) { case QSslCertificate::Organization: return tr("Organization"); case QSslCertificate::CommonName: return tr("Common Name"); case QSslCertificate::LocalityName: return tr("Locality"); case QSslCertificate::OrganizationalUnitName: return tr("Organizational Unit"); case QSslCertificate::CountryName: return tr("Country"); case QSslCertificate::StateOrProvinceName: return tr("State or Province"); } return tr("error", "unknown certificate subject info"); } }; #endif