/*! @file @id $Id$ */ // 1 2 3 4 5 6 7 8 // 45678901234567890123456789012345678901234567890123456789012345678901234567890 #include #include #include #include // show certificate information void show(const suisseid::Certificate& cert) { // makes use of qt library's certificate class QSslCertificate c(QByteArray(cert.data(), cert.size()), QSsl::Der); std::cout<<"Certificate info: CN=" <name()<version()<minimalPinLength() <<" - "<<(*card)->maximalPinLength()<pkcs15PinRetries()<sigGPinRetries()<transportPinRetries()<pukRetries()<sessionInfo()); std::cout<<" Session:"<certificates()); std::cout<<" Certificates: "<>choice; // small user menu try { if (choice=="n") { // handled above in the while-loop } else if (choice=="c") { // run a check of the card status TextualCycle check(*card); if (check.run()) std::cout<<"----> SuisseID is fine"< SuisseID is bad"<>oldpin; std::cout<<"Enter New PIN: "; std::cin>>newpin; if (oldpin.size() && newpin.size()) (*card)->changePins(newpin, oldpin); } else if (choice=="i") { // install new certificates - not fully implemented TextualCycle check(*card); check.installCerts(true); } else if (choice=="z") { // show all certificates on the card for (suisseid::Certificates::iterator cert(certs.begin()); cert!=certs.end(); ++cert) { show(*cert); } } else if (choice=="a") { // show authentication certificate only show((*card)->authenticationCertificate()); } else if (choice=="d") { // show authentication certificate only show((*card)->digitalSignatureCertificate()); } else if (choice=="q") { // done, user quits return 0; } else { // unknown user command std::cout<<"I beg your pardon, Sir?"<