read more than one certificate from a file; take file names in command line arguments
This commit is contained in:
@@ -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;
|
||||||
Certificate* win(new Certificate(_mdi));
|
}
|
||||||
_mdi->addSubWindow(win)->setWindowTitle(QFileInfo(fileName).fileName());
|
for (const QSslCertificate& c: QSslCertificate::fromDevice(&file)) {
|
||||||
win->show();
|
Certificate* win(new Certificate(_mdi));
|
||||||
win->certificate(c);
|
_mdi->addSubWindow(win)->setWindowTitle
|
||||||
} else {
|
(c.subjectInfo(QSslCertificate::CommonName).join(", ")
|
||||||
status = false;
|
+" ("+QFileInfo(fileName).fileName()+")");
|
||||||
qDebug()<<QObject::trUtf8("Cannot read PEM certificate from file: %1")
|
win->show();
|
||||||
.arg(fileName);
|
win->certificate(c);
|
||||||
}
|
status = true;
|
||||||
}
|
}
|
||||||
file.close();
|
file.close();
|
||||||
return status;
|
return status;
|
||||||
|
Reference in New Issue
Block a user