fixed tons of warnings; refs #28
This commit is contained in:
		| @@ -104,9 +104,8 @@ class Commands: public cardos::Commands { | ||||
|  | ||||
|     void selectReader() { | ||||
|       listReader(); | ||||
|       if (_readers.size()<0) return; | ||||
|       int num(-1); | ||||
|       if (std::cin>>num && num>=0 && num<_readers.size()) { | ||||
|       pcsc::Connection::Strings::size_type num(0); | ||||
|       if (std::cin>>num && num<_readers.size()) { | ||||
|         _reader = pcsc::Connection::reader(_readers[num]); | ||||
|         std::cout<<"Active Reader: "<<_readers[num]<<std::endl; | ||||
|       } else throw std::runtime_error("no valid reader selected"); | ||||
|   | ||||
| @@ -21,8 +21,6 @@ | ||||
| #include <iostream> | ||||
| #include <iomanip> | ||||
|  | ||||
| pcsc::Connection::Strings readers; | ||||
|  | ||||
| void list() { | ||||
|   pcsc::Connection::Strings readers(pcsc::Connection::scan()); | ||||
|   std::cout<<"Found "<<readers.size()<<" readers" | ||||
| @@ -34,7 +32,7 @@ void list() { | ||||
| } | ||||
|  | ||||
| int main(int argc, char** argv) try { | ||||
|   int reader(0); | ||||
|   unsigned int reader(0); | ||||
|   std::string pin; | ||||
|   std::string path("3f00"); | ||||
|   std::string id("8888"); | ||||
| @@ -62,7 +60,7 @@ int main(int argc, char** argv) try { | ||||
|                                      <<mrw::args::param(data, "text")) | ||||
|                    ); | ||||
|   pcsc::Connection::Strings readers(pcsc::Connection::scan()); | ||||
|   if (reader<0 || readers.size()<reader) { | ||||
|   if (readers.size()<reader) { | ||||
|     std::cerr<<"reader not found: "<<reader<<std::endl; | ||||
|     return 1; | ||||
|   } | ||||
|   | ||||
| @@ -75,14 +75,14 @@ int main(int argc, char const*const*const argv) try { | ||||
|       cryptoki::Session session(*it); | ||||
|       cryptoki::ObjectList objs(session.find()); | ||||
|       std::cout<<"Objects Found: "<<objs.size()<<std::endl; | ||||
|       for (cryptoki::ObjectList::iterator it(objs.begin()); | ||||
|            it!=objs.end(); ++it) { | ||||
|       for (cryptoki::ObjectList::iterator it2(objs.begin()); | ||||
|            it2!=objs.end(); ++it2) { | ||||
|         std::cout<<"-------------------- Object -----------------"<<std::endl; | ||||
|         cryptoki::AttributeMap attrs(it->attributes()); | ||||
|         for (cryptoki::AttributeMap::iterator it(attrs.begin()); | ||||
|              it!=attrs.end(); ++it) { | ||||
|           std::cout<<" - attribute: "<<it->second.name()<<" = "<<std::endl | ||||
|                    <<crypto::readable(it->second.value, 15, 5)<<std::endl; | ||||
|         cryptoki::AttributeMap attrs(it2->attributes()); | ||||
|         for (cryptoki::AttributeMap::iterator it3(attrs.begin()); | ||||
|              it3!=attrs.end(); ++it3) { | ||||
|           std::cout<<" - attribute: "<<it3->second.name()<<" = "<<std::endl | ||||
|                    <<crypto::readable(it3->second.value, 15, 5)<<std::endl; | ||||
|         } | ||||
|       } | ||||
|       std::cout<<"**** Success"<<std::endl; | ||||
|   | ||||
| @@ -71,17 +71,18 @@ int main(int argc, char** argv) try { | ||||
|     cryptoki::ObjectList certs | ||||
|       (session.find(cryptoki::Attribute(CKA_CLASS) | ||||
|                     .from<CK_OBJECT_CLASS>(CKO_CERTIFICATE))); | ||||
|     for (cryptoki::ObjectList::iterator c(certs.begin()); c!=certs.end(); ++c) { | ||||
|       std::string label(c->attribute(CKA_LABEL).value); | ||||
|     for (cryptoki::ObjectList::iterator it(certs.begin()); | ||||
|          it!=certs.end(); ++it) { | ||||
|       std::string label(it->attribute(CKA_LABEL).value); | ||||
|       if (cert.size()&&cert!=label) continue; | ||||
|       cryptoki::Attribute id(c->attribute(CKA_ID)); | ||||
|       cryptoki::Attribute id(it->attribute(CKA_ID)); | ||||
|       cryptoki::ObjectList keys | ||||
|         (session.find(cryptoki::Attribute(CKA_CLASS) | ||||
|                       .from<CK_OBJECT_CLASS>(CKO_PUBLIC_KEY), | ||||
|                       id)); | ||||
|       if (!keys.size()) continue; | ||||
|       std::cout<<"Found Certificate: " | ||||
|                    <<c->attribute(CKA_LABEL).value<<std::endl; | ||||
|                    <<it->attribute(CKA_LABEL).value<<std::endl; | ||||
|       if (!cert.size()) continue; | ||||
|       std::cout<<"Pin: "; | ||||
|       std::string pin; | ||||
| @@ -98,7 +99,7 @@ int main(int argc, char** argv) try { | ||||
| #ifndef MRW__OLD_PRE11_COMPILER | ||||
|       auto start = std::chrono::system_clock::now(); | ||||
| #endif | ||||
|       for (int i(0); i<r; ++i) | ||||
|       for (unsigned int i(0); i<r; ++i) | ||||
|         std::cout<<"Text:"<<std::endl | ||||
|                  <<crypto::readable(txt)<<std::endl | ||||
|                  <<"Signature:"<<std::endl | ||||
|   | ||||
		Reference in New Issue
	
	Block a user