|
|
@ -35,21 +35,21 @@ class CertMan: public QMainWindow, protected Ui::CertMan { |
|
|
|
SLOT(certificate(QUrl, QSslCertificate))); |
|
|
|
SLOT(certificate(QUrl, QSslCertificate))); |
|
|
|
} |
|
|
|
} |
|
|
|
bool open(const QString& fileName) { |
|
|
|
bool open(const QString& fileName) { |
|
|
|
bool status(true); |
|
|
|
bool status(false); |
|
|
|
QFile file(fileName); |
|
|
|
QFile file(fileName); |
|
|
|
file.open(QIODevice::ReadOnly); |
|
|
|
file.open(QIODevice::ReadOnly); |
|
|
|
while (!file.atEnd()) { |
|
|
|
if (file.error()!=QFileDevice::NoError) { |
|
|
|
QSslCertificate c(&file); |
|
|
|
qDebug()<<"Error open file"<<fileName<<file.errorString(); |
|
|
|
if (!c.isNull()) { |
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (const QSslCertificate& c: QSslCertificate::fromDevice(&file)) { |
|
|
|
Certificate* win(new Certificate(_mdi)); |
|
|
|
Certificate* win(new Certificate(_mdi)); |
|
|
|
_mdi->addSubWindow(win)->setWindowTitle(QFileInfo(fileName).fileName()); |
|
|
|
_mdi->addSubWindow(win)->setWindowTitle |
|
|
|
|
|
|
|
(c.subjectInfo(QSslCertificate::CommonName).join(", ") |
|
|
|
|
|
|
|
+" ("+QFileInfo(fileName).fileName()+")"); |
|
|
|
win->show(); |
|
|
|
win->show(); |
|
|
|
win->certificate(c); |
|
|
|
win->certificate(c); |
|
|
|
} else { |
|
|
|
status = true; |
|
|
|
status = false; |
|
|
|
|
|
|
|
qDebug()<<QObject::trUtf8("Cannot read PEM certificate from file: %1") |
|
|
|
|
|
|
|
.arg(fileName); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
file.close(); |
|
|
|
file.close(); |
|
|
|
return status; |
|
|
|
return status; |
|
|
|