A simple Qt based browser with no bullshit that supports PKCS#11 tokens (such as 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.
 
 
 
 

48 lines
1.4 KiB

#include <QApplication>
#include <QtNetwork>
#include <QtWebKit>
#include <QList>
#include <QFile>
#include <iostream>
#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<QSslCertificate> 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;
}