From 41d8c55db66f53d2c0bf9b277e60c43a017ba841 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=A4ckerlin?= Date: Thu, 12 Dec 2013 13:40:00 +0000 Subject: [PATCH] add example for using QSslCertificate; refs #28 --- COPYING | 2 +- INSTALL | 2 +- configure.in | 2 +- doc/examples/makefile.am | 4 ++-- doc/examples/suisse-id-demo.cxx | 18 ++++++++++++++++++ 5 files changed, 23 insertions(+), 5 deletions(-) diff --git a/COPYING b/COPYING index 6168a39..2fcb217 120000 --- a/COPYING +++ b/COPYING @@ -1 +1 @@ -/usr/share/automake-1.11/COPYING \ No newline at end of file +/usr/share/automake-1.13/COPYING \ No newline at end of file diff --git a/INSTALL b/INSTALL index cbd1c80..8b641e3 120000 --- a/INSTALL +++ b/INSTALL @@ -1 +1 @@ -/usr/share/automake-1.11/INSTALL \ No newline at end of file +/usr/share/automake-1.13/INSTALL \ No newline at end of file diff --git a/configure.in b/configure.in index c3d26a2..af9a240 100644 --- a/configure.in +++ b/configure.in @@ -94,7 +94,7 @@ AC_CHECK_PROG(have_dot, dot, yes, no) PKG_PROG_PKG_CONFIG # libraries -#PKG_CHECK_MODULES([QT], [QtNetwork]) +PKG_CHECK_MODULES([QT], [QtNetwork]) AC_ARG_ENABLE(pedantic, [AS_HELP_STRING([--enable-pedantic], diff --git a/doc/examples/makefile.am b/doc/examples/makefile.am index 524effd..e300c4c 100644 --- a/doc/examples/makefile.am +++ b/doc/examples/makefile.am @@ -36,8 +36,8 @@ openssl_engine_demo_SOURCES = openssl-engine-demo.cxx cardos_demo_SOURCES = cardos-demo.cxx suisse_id_demo_SOURCES = suisse-id-demo.cxx # moc_suisse-id-demo.cxx -#suisse_id_demo_CXXFLAGS = ${QT_CFLAGS} -#suisse_id_demo_LDADD = ${QT_LIBS} +suisse_id_demo_CXXFLAGS = ${QT_CFLAGS} +suisse_id_demo_LDADD = ${QT_LIBS} moc_%.cxx: %.hxx moc -o $@ $< diff --git a/doc/examples/suisse-id-demo.cxx b/doc/examples/suisse-id-demo.cxx index 01c9ead..ace3514 100644 --- a/doc/examples/suisse-id-demo.cxx +++ b/doc/examples/suisse-id-demo.cxx @@ -8,6 +8,9 @@ #include #include +#include +#include + int main(int argc, char** argv) try { std::string lib("libcvP11.so"); mrw::args::parse(argc, argv, @@ -53,6 +56,7 @@ int main(int argc, char** argv) try { <<" r: remove all certificates"<>choice; try { @@ -76,6 +80,20 @@ int main(int argc, char** argv) try { } else if (choice=="i") { TextualCycle check(*card); check.installCerts(true); + } else if (choice=="z") { + for (cryptoki::ObjectList::iterator cert(certs.begin()); + cert!=certs.end(); ++cert) { + std::string data(cert->attribute(CKA_VALUE).value); + QByteArray der(QByteArray(data.data(), data.size())); + QSslCertificate c(der, QSsl::Der); + std::cout<<"Certificate info: CN=" + <