preparations for writing a file; refs #28

This commit is contained in:
Marc Wäckerlin
2014-03-07 15:53:22 +00:00
parent 9ec9bea1a0
commit da028032e7
6 changed files with 148 additions and 57 deletions

View File

@@ -40,6 +40,7 @@ class Commands: public cardos::Commands {
<<" (s)elect(f)ile <hex> Select file below master"<<std::endl
<<" (s)elect(p)15(f)ile <hex> Select file below PKCS#15"<<std::endl
<<" (s)elect(s)igg(f)ile <hex> Select file below SigG"<<std::endl
<<" (r)ead(b)erfile Read selected BER file"<<std::endl
<<" (r)ead(b)in(f)ile Read selected binary file"<<std::endl
<<" (r)ead(a)bsolute(r)ecord Read absolute record"<<std::endl
<<" (r)ead(f)irst(r)ecord Read first record"<<std::endl
@@ -69,7 +70,8 @@ class Commands: public cardos::Commands {
else if (cmd=="selectfile"||cmd=="sf") selectMfFile(apdu());
else if (cmd=="selectp15file"||cmd=="spf") selectPkcs15File(apdu());
else if (cmd=="selectsiggfile"||cmd=="ssf") selectSigGFile(apdu());
else if (cmd=="readbinfile"||cmd=="rbf") _ber=readBinFile();
else if (cmd=="readberfile"||cmd=="rb") _ber=readBerFile();
else if (cmd=="readbinfile"||cmd=="rbf") readBinary();
else if (cmd=="readabsoluterecord"||cmd=="rar") _ber=readRecord();
else if (cmd=="readfirstrecord"||cmd=="rfr")
_ber=readRecord(0, 0, FIRST_RECORD);
@@ -116,12 +118,12 @@ class Commands: public cardos::Commands {
while (true) {
std::string res(send(0x00, 0xB2, 0, NEXT_RECORD));
if (cardos::Commands::retCode(res)!=0x9000) break;
cardos::BerValue record(cardos::Commands::retData(res).substr(2));
cardos::BerValues record(cardos::Commands::retData(res).substr(2));
_ber += record;
std::cout<<record[0][0].value()
std::cout<<record[0][0][0].string()
<<": len="
<<record[2][0][2].toULong()
<<"-"<<record[2][0][4].toULong()<<std::endl;
<<record[0][2][0][2].ulong()
<<"-"<<record[0][2][0][4].ulong()<<std::endl;
}
}

View File

@@ -6,7 +6,8 @@
noinst_HEADERS = suisse-id-demo.hxx
noinst_PROGRAMS = pcsc-demo cryptoki-sign-demo cryptoki-demo \
openssl-tcp-demo openssl-ssl-demo \
openssl-engine-demo suisse-id-demo cardos-demo
openssl-engine-demo suisse-id-demo cardos-demo \
create-files-demo
AM_CPPFLAGS += -I${top_srcdir}/src -I/usr/include/PCSC
AM_LDFLAGS = -L${top_builddir}/src -lpcscxx
@@ -35,6 +36,7 @@ openssl_ssl_demo_SOURCES = openssl-ssl-demo.cxx
openssl_engine_demo_SOURCES = openssl-engine-demo.cxx
cardos_demo_SOURCES = cardos-demo.cxx
suisse_id_demo_SOURCES = suisse-id-demo.cxx
create_files_demo_SOURCES = create-files-demo.cxx
# moc_suisse-id-demo.cxx
suisse_id_demo_CXXFLAGS = ${QT_CFLAGS}
suisse_id_demo_LDADD = ${QT_LIBS}

View File

@@ -39,7 +39,7 @@ int main(int argc, char** argv) try {
"Sign a text (optionally several times for performance"
" measurements).",
mrw::args::defaults()
<<mrw::args::decl("l", "library", "cryptoki lirary to load",
<<mrw::args::decl("l", "library", "cryptoki library to load",
mrw::args::decl::param_list()
<<mrw::args::param(lib, "lib")));
// now lib contains the dynamic library to load