#include #include #include #include #include #include #include "smartcardauth.h" SmartCardAuth g_scard_auth; int main(int argc, char *argv[]) { SmartCardAuth::initialize(); QApplication app(argc, argv); QSslConfiguration sslConf(QSslConfiguration::defaultConfiguration()); // Works even without specifying the root certificate, we just need to add the intermediates, // and that's done in SmartCardAuth.cpp #if 0 QFile caCertsFile("D:\\QtSmartCardAuth_TMI\\QtSslTest\\swsign_root.pem"); caCertsFile.open(QIODevice::ReadOnly); QList chain( QSslCertificate::fromDevice(&caCertsFile) ); sslConf.setCaCertificates(chain); #endif sslConf.setPeerVerifyMode(QSslSocket::QueryPeer); sslConf.setOpenSslHook(&g_scard_auth); QSslConfiguration::setDefaultConfiguration(sslConf); // TODO - IMPORTANT: Error reporting! // If there is ANY failure (no network, no host resolution, no SSL connection, timeout) we just see a // blank page! QWebView web; // Works - NEEDS AN INTERMEDIATE CERTIFICATE, either loaded from card or from file, see SmartCardAuth web.load(QUrl("https://dev.swisssign.com/test/")); // web.load(QUrl("https://e2k7.demo8.cryptovision.com/ssl/")); web.show(); int rv=app.exec(); SmartCardAuth::deinitialize(); return rv; }