NIST Biometric Evaluation Framework
Software components for biometric technology evaluations
|
Representation of a single ISO 7816 smartcard in the system. More...
#include <be_device_smartcard.h>
Classes | |
class | APDU |
struct | APDUException |
Exception thrown when a command fails. More... | |
struct | APDUResponse |
The data and status words returned by the card in response to a command. More... | |
Public Member Functions | |
Smartcard (unsigned int cardNum) | |
Connect to the Nth card in the system independent of any application installed on the card. More... | |
Smartcard (unsigned int cardNum, const Memory::uint8Array &appID) | |
Connect to the Nth card in the system and activate the application with the given identifier. More... | |
Memory::uint8Array | getDedicatedFileObject (const Memory::uint8Array &objectID) |
Read a data object from the application dedicated file. More... | |
APDUResponse | sendAPDU (Device::Smartcard::APDU &apdu) |
Send an APDU to a card using the best transmission method available for the card. More... | |
Memory::uint8Array | getLastAPDU () const |
Obtain a copy of the last APDU sent to the card. More... | |
Memory::uint8Array | getLastResponseData () const |
Obtain a copy of the last response data returned from the card. More... | |
std::string | getReaderID () const |
Obtain the identifier of the reader that the smartcard is plugged into. More... | |
void | setDryrun (bool state) |
Set the 'dryrun' state. More... | |
~Smartcard () | |
Destructor. More... | |
Smartcard (Smartcard &&other) noexcept | |
Move constructor. More... | |
Smartcard & | operator= (Smartcard &&other) noexcept |
Move assignment. More... | |
Representation of a single ISO 7816 smartcard in the system.
A card can be associated with an application that is present on the card. Smartcards are accessed with a command/response protocol, and this class provides the capability to retrieve the response status and data whether the command succeeds or fails.
Definition at line 31 of file be_device_smartcard.h.
BiometricEvaluation::Device::Smartcard::Smartcard | ( | unsigned int | cardNum | ) |
Connect to the Nth card in the system independent of any application installed on the card.
Cards are numbered according to reader sequencing. Therefore, the first card (number 0) is expected to be in the first reader.
[in] | cardNum | The number of the card to attach to. |
Error::ParameterError | No card exists for the given card number. |
Error::StrategyError | Failed to access at least one of the readers. |
BiometricEvaluation::Device::Smartcard::Smartcard | ( | unsigned int | cardNum, |
const Memory::uint8Array & | appID | ||
) |
Connect to the Nth card in the system and activate the application with the given identifier.
Cards are numbered according to reader sequencing. Therefore, the first card (number 0) is expected to be in the first reader. The response data from application activation can be retrieved with the getLastResponseData() method.
[in] | cardNum | The number of the card to attach to. |
[in] | appID | The ID of the application to activate on the card. |
APDUException | An error occurred activating the application. The status word fields on the exception's response object should be read to determine the error. |
Error::ParameterError | No card exists for the given card number with the given application ID. |
Error::StrategyError | Failed to access at least one of the readers. |
BiometricEvaluation::Device::Smartcard::~Smartcard | ( | ) |
Destructor.
|
noexcept |
Move constructor.
Smartcard objects are movable, maintaining the single instance of the access to the physical card. This allows the object to be placed in an STL container.
Memory::uint8Array BiometricEvaluation::Device::Smartcard::getDedicatedFileObject | ( | const Memory::uint8Array & | objectID | ) |
Read a data object from the application dedicated file.
The objectID parameter must be a TLV octet string with the tag set to one of these values:
[in] | objectID | The ID of the requested object. |
APDUException | An error occurred activating the application. The status word fields on the exception's response object should be read to determine the error. The data field of the response may contain partial data from the card. |
Error::StrategyError | An error occurred when communicating with the card. |
Error::ParameterError | The object ID is too large. |
APDUResponse BiometricEvaluation::Device::Smartcard::sendAPDU | ( | Device::Smartcard::APDU & | apdu | ) |
Send an APDU to a card using the best transmission method available for the card.
[in,out] | apdu | The APDU to be sent. Fields may be modified by the function, specifically the length field(s). |
APDUException | The status words from the command response are something other than 0x9000. The status word fields on the exception's response object should read to determine the result of the command. The data field of the response may contain partial data from the card. |
Error::StrategyError | An error occurred when communicating with the card. |
Memory::uint8Array BiometricEvaluation::Device::Smartcard::getLastAPDU | ( | ) | const |
Memory::uint8Array BiometricEvaluation::Device::Smartcard::getLastResponseData | ( | ) | const |
Obtain a copy of the last response data returned from the card.
std::string BiometricEvaluation::Device::Smartcard::getReaderID | ( | ) | const |
Obtain the identifier of the reader that the smartcard is plugged into.
void BiometricEvaluation::Device::Smartcard::setDryrun | ( | bool | state | ) |
Set the 'dryrun' state.
[in] | state | True when the APDU should be created, but not sent to the card. @seealso getLastAPDU() |
Move assignment.
Smartcard objects are movable, maintaining the single instance of the access to the physical card. This allows the object to be placed in an STL container.