|
|
@ -12,7 +12,8 @@ |
|
|
|
#include <cryptoki.hxx> |
|
|
|
#include <cryptoki.hxx> |
|
|
|
#include <pcsc.hxx> |
|
|
|
#include <pcsc.hxx> |
|
|
|
#include <mrw/vector.hxx> |
|
|
|
#include <mrw/vector.hxx> |
|
|
|
#include <mrw/shared.hxx> |
|
|
|
#include <mrw/checkcxx11.hxx> |
|
|
|
|
|
|
|
#include <memory> |
|
|
|
|
|
|
|
|
|
|
|
/*! @defgroup gsuisseid C++ library to access SuisseID smart cards
|
|
|
|
/*! @defgroup gsuisseid C++ library to access SuisseID smart cards
|
|
|
|
|
|
|
|
|
|
|
@ -185,7 +186,7 @@ namespace suisseid { |
|
|
|
/** Instance requires a connenction to the reader an a cryptoky
|
|
|
|
/** Instance requires a connenction to the reader an a cryptoky
|
|
|
|
library. This is passes automatically when this class is |
|
|
|
library. This is passes automatically when this class is |
|
|
|
instanciated through suisseid::Scanner. */ |
|
|
|
instanciated through suisseid::Scanner. */ |
|
|
|
Card(mrw::Shared<pcsc::Connection::Reader> reader, |
|
|
|
Card(std::shared_ptr<pcsc::Connection::Reader> reader, |
|
|
|
const cryptoki::Library& cryptoki): |
|
|
|
const cryptoki::Library& cryptoki): |
|
|
|
cardos::Commands(reader), |
|
|
|
cardos::Commands(reader), |
|
|
|
_cryptoki(cryptoki) { |
|
|
|
_cryptoki(cryptoki) { |
|
|
@ -205,7 +206,7 @@ namespace suisseid { |
|
|
|
pcsc::Connection::Reader::Transaction lock(card.reader()); |
|
|
|
pcsc::Connection::Reader::Transaction lock(card.reader()); |
|
|
|
[... do some low level stuff ...] |
|
|
|
[... do some low level stuff ...] |
|
|
|
@endcode */ |
|
|
|
@endcode */ |
|
|
|
mrw::Shared<pcsc::Connection::Reader> reader() { |
|
|
|
std::shared_ptr<pcsc::Connection::Reader> reader() { |
|
|
|
return _reader; |
|
|
|
return _reader; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -290,7 +291,7 @@ namespace suisseid { |
|
|
|
public: |
|
|
|
public: |
|
|
|
|
|
|
|
|
|
|
|
/// @copydoc Card::Card
|
|
|
|
/// @copydoc Card::Card
|
|
|
|
Post(mrw::Shared<pcsc::Connection::Reader> reader, |
|
|
|
Post(std::shared_ptr<pcsc::Connection::Reader> reader, |
|
|
|
const cryptoki::Library& cryptoki): |
|
|
|
const cryptoki::Library& cryptoki): |
|
|
|
Card(reader, cryptoki), _minPinLen(0), _maxPinLen(0) { |
|
|
|
Card(reader, cryptoki), _minPinLen(0), _maxPinLen(0) { |
|
|
|
} |
|
|
|
} |
|
|
@ -368,7 +369,7 @@ namespace suisseid { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
//! List of cards, returned by @ref suisseid::Scanner::scan.
|
|
|
|
//! List of cards, returned by @ref suisseid::Scanner::scan.
|
|
|
|
typedef std::vector<mrw::Shared<Card> > Cards; |
|
|
|
typedef std::vector<std::shared_ptr<Card> > Cards; |
|
|
|
|
|
|
|
|
|
|
|
//! Auxiliary SuisseID card manager.
|
|
|
|
//! Auxiliary SuisseID card manager.
|
|
|
|
/** Use this manager to scan your system for SuisseID cards.
|
|
|
|
/** Use this manager to scan your system for SuisseID cards.
|
|
|
@ -418,7 +419,7 @@ namespace suisseid { |
|
|
|
CRYPTOLOG("number of cryptoki-readers for "<<*reader |
|
|
|
CRYPTOLOG("number of cryptoki-readers for "<<*reader |
|
|
|
<<": "<<slots.size()); |
|
|
|
<<": "<<slots.size()); |
|
|
|
if (slots.size()==1) |
|
|
|
if (slots.size()==1) |
|
|
|
res.push_back(dynamic_cast<Card*> |
|
|
|
res.push_back(std::shared_ptr<Card> |
|
|
|
(new Post(pcsc::Connection::reader(*reader), |
|
|
|
(new Post(pcsc::Connection::reader(*reader), |
|
|
|
_cryptoki))); |
|
|
|
_cryptoki))); |
|
|
|
} |
|
|
|
} |
|
|
@ -435,7 +436,7 @@ namespace suisseid { |
|
|
|
|
|
|
|
|
|
|
|
public: |
|
|
|
public: |
|
|
|
|
|
|
|
|
|
|
|
StatusCycle(mrw::Shared<Card> card, unsigned int maxRetries = 20): |
|
|
|
StatusCycle(std::shared_ptr<Card> card, unsigned int maxRetries = 20): |
|
|
|
_card(card), _maxRetries(maxRetries), _counter(0) { |
|
|
|
_card(card), _maxRetries(maxRetries), _counter(0) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -449,7 +450,7 @@ namespace suisseid { |
|
|
|
|
|
|
|
|
|
|
|
protected: |
|
|
|
protected: |
|
|
|
|
|
|
|
|
|
|
|
mrw::Shared<Card> card() { |
|
|
|
std::shared_ptr<Card> card() { |
|
|
|
return _card; |
|
|
|
return _card; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -595,7 +596,7 @@ namespace suisseid { |
|
|
|
return start(); |
|
|
|
return start(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
mrw::Shared<Card> _card; |
|
|
|
std::shared_ptr<Card> _card; |
|
|
|
unsigned int _maxRetries; |
|
|
|
unsigned int _maxRetries; |
|
|
|
unsigned int _counter; |
|
|
|
unsigned int _counter; |
|
|
|
|
|
|
|
|
|
|
|