|
|
@ -8,6 +8,9 @@ |
|
|
|
#include <suisse-id-demo.hxx> |
|
|
|
#include <suisse-id-demo.hxx> |
|
|
|
#include <mrw/args.hxx> |
|
|
|
#include <mrw/args.hxx> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <QtNetwork/QSslCertificate> |
|
|
|
|
|
|
|
#include <QtCore/QDateTime> |
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char** argv) try { |
|
|
|
int main(int argc, char** argv) try { |
|
|
|
std::string lib("libcvP11.so"); |
|
|
|
std::string lib("libcvP11.so"); |
|
|
|
mrw::args::parse(argc, argv, |
|
|
|
mrw::args::parse(argc, argv, |
|
|
@ -53,6 +56,7 @@ int main(int argc, char** argv) try { |
|
|
|
<<" r: remove all certificates"<<std::endl |
|
|
|
<<" r: remove all certificates"<<std::endl |
|
|
|
<<" p: PIN change"<<std::endl |
|
|
|
<<" p: PIN change"<<std::endl |
|
|
|
<<" i: (re-) import certificates"<<std::endl |
|
|
|
<<" i: (re-) import certificates"<<std::endl |
|
|
|
|
|
|
|
<<" z: show certificates"<<std::endl |
|
|
|
<<" q: quit"<<std::endl; |
|
|
|
<<" q: quit"<<std::endl; |
|
|
|
std::cin>>choice; |
|
|
|
std::cin>>choice; |
|
|
|
try { |
|
|
|
try { |
|
|
@ -76,6 +80,20 @@ int main(int argc, char** argv) try { |
|
|
|
} else if (choice=="i") { |
|
|
|
} else if (choice=="i") { |
|
|
|
TextualCycle check(*card); |
|
|
|
TextualCycle check(*card); |
|
|
|
check.installCerts(true); |
|
|
|
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=" |
|
|
|
|
|
|
|
<<QString(c.subjectInfo(QSslCertificate::CommonName) |
|
|
|
|
|
|
|
.toUtf8()).toStdString() |
|
|
|
|
|
|
|
<<std::endl |
|
|
|
|
|
|
|
<<" Valid until: " |
|
|
|
|
|
|
|
<<QString(c.expiryDate().toString().toUtf8()).toStdString() |
|
|
|
|
|
|
|
<<std::endl; |
|
|
|
|
|
|
|
} |
|
|
|
} else if (choice=="q") { |
|
|
|
} else if (choice=="q") { |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|