add new commnds to read CardOS Version

master
Marc Wäckerlin 6 years ago
parent 79dd30b711
commit ad6f83e0e4
  1. 13
      examples/cardos-demo.cxx

@ -52,7 +52,9 @@ class Commands: public cardos::Commands {
<<" (l)ogonpu(k) <pin> logon with user PUK"<<std::endl
<<" (l)ogon(s)igg <pin> logon with SigG PIN"<<std::endl
<<" (l)ogon(t)transport <pin> logon with transport PIN"<<std::endl
<<" (g)et(p)in(l)engths get PIN min max lengths"<<std::endl
<<" (g)et(p)in(l)engths get PIN min max lengths"<<std::endl
<<" (c)hip get chip production data"<<std::endl
<<" (v)ersion get product data"<<std::endl
<<"Note: \"(h)elp\" means: type \"help\" or simply \"h\""<<std::endl;
}
@ -86,6 +88,8 @@ class Commands: public cardos::Commands {
else if (cmd=="logontransport"||cmd=="lt") logonTransport(pin());
else if (cmd=="getpinlengths"||cmd=="gpl") getPinLengths();
else if (cmd=="print"||cmd=="p") std::cout<<_ber.print()<<std::endl;
else if (cmd=="chip"||cmd=="c") printDataChipProduction();
else if (cmd=="version"||cmd=="v") std::cout<<getDataProductName()<<std::endl;
else help();
} catch (const std::exception& e) {
std::cout<<"**** Error: "<<e.what()<<std::endl;
@ -126,6 +130,13 @@ class Commands: public cardos::Commands {
<<"-"<<record[0][2][0][4].ulong()<<std::endl;
}
}
void printDataChipProduction() {
ChipProductionData data=getDataChipProduction();
std::cout<<"serial: "<<crypto::hex(data.serial)<<std::endl
<<"type: "<<crypto::hex(std::string(1, data.type))<<std::endl
<<"id: "<<crypto::hex(data.id)<<std::endl;
}
private:

Loading…
Cancel
Save