This library provides a simple and nice C++ wrapper around these libraries, so that programmers can concentrate on functionality. It offers general support for PCSC-lite, OpenSSL, PKCS#11, plus specific functionality for the SuisseID.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.2 KiB

/*! @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;
}