// g++ -I ../../src -I /usr/include/opencryptoki cryptoki-demo.cpp ../../src/cryptoki.cxx -ldl -ggdb3 #include #include template std::vector toVector(TYPE in[NUM]) { return std::vector(in, in+NUM); } #define VECTOR(ARRAY) toVector(ARRAY) template void print(const std::vector& v) { for (typename std::vector::const_iterator it(v.begin()); it!=v.end(); ++it) std::cout<<"Item: "<<*it< v(toVector<4>((int[]){1,2,3,4})); std::vector v(VECTOR(((int[]){1,2,3,4}))); print(v); cryptoki::Init init(argc==2?argv[1]:"onepin-opensc-pkcs11.so"); cryptoki::Info inf(init.info()); std::cout<<"##################### INFO #####################"<slotinfo()); std::cout<<"##################### S-CARD #####################"<tokeninfo()); std::cout<<"--------------------- Token ----------------------"<mechanismlist()); for (cryptoki::MechanismList::iterator it2(mechs.begin()); it2!=mechs.end(); ++it2) { cryptoki::MechanismInfo mechinfo(it->mechanisminfo(*it2)); std::cout<<"-------------------- Mechanism -----------------"<