forgoten to add new file

master
Marc Wäckerlin 9 years ago
parent cad79f90e9
commit 6d7f5c80fb
  1. 37
      src/cert2text.cxx

@ -0,0 +1,37 @@
/*! @file
@id $Id$
*/
// 1 2 3 4 5 6 7 8
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
#include <QCoreApplication>
#include <QCommandLineParser>
#include <QSslConfiguration>
#include <QSslCertificate>
#include <QSslKey>
#include <iostream>
int main(int argc, char *argv[]) try {
QCoreApplication a(argc, argv);
QCommandLineParser parser;
parser.addHelpOption();
parser.process(a);
QStringList urls(parser.positionalArguments());
for (QStringList::iterator it(urls.begin()); it!=urls.end(); ++it) {
QList<QSslCertificate> cert(QSslCertificate::fromPath(*it));
if (!cert.size())
throw std::runtime_error("cannot read ca certificate file "
+it->toStdString());
std::cout<<"**** "<<it->toStdString()<<" contains "
<<cert.size()<<" certificates: "<<std::endl;
for (QList<QSslCertificate>::iterator it2(cert.begin());
it2!=cert.end(); ++it2)
std::cout<<cert[0].toText().toStdString()<<std::endl
<<"----------------------------"<<std::endl;
}
return 0;
} catch (std::exception &x) {
std::cerr<<"**** error: "<<x.what()<<std::endl;
return 1;
}
Loading…
Cancel
Save