NIST Biometric Evaluation Framework
Software components for biometric technology evaluations
be_device_smartcard.h
Go to the documentation of this file.
1/*
2 * This software was developed at the National Institute of Standards and
3 * Technology (NIST) by employees of the Federal Government in the course
4 * of their official duties. Pursuant to title 17 Section 105 of the
5 * United States Code, this software is not subject to copyright protection
6 * and is in the public domain. NIST assumes no responsibility whatsoever for
7 * its use by other parties, and makes no guarantees, expressed or implied,
8 * about its quality, reliability, or any other characteristic.
9 */
10
11#ifndef __BE_DEVICE_SMARTCARD_H__
12#define __BE_DEVICE_SMARTCARD_H__
13
14#include <cstdint>
15#include <memory>
16#include <string>
17#include <be_memory_autoarray.h>
18
19namespace BiometricEvaluation
20{
21 namespace Device
22 {
31 class Smartcard {
32 public:
33 class APDU; /* Represents an APDU sent to a card */
34
40 struct APDUResponse {
42 uint8_t sw1{0};
43
45 uint8_t sw2{0};
46
49
51 APDUResponse() = default;
52
63 const uint8_t sw1,
64 const uint8_t sw2);
65
66 ~APDUResponse() = default;
67 };
68
85
90
92 APDUException() = default;
93
101 const APDUResponse &response,
102 const Memory::uint8Array &apdu);
103 };
104
121 unsigned int cardNum);
122
148 unsigned int cardNum,
149 const Memory::uint8Array &appID);
150
177 const Memory::uint8Array &objectID);
178
198
205
214
223 std::string getReaderID() const;
224
232 void setDryrun(bool state);
233
234 /*
235 * We cannot use the default destructor here due to the
236 * Impl smart pointer contained within this object.
237 */
242
252 Smartcard(Smartcard&& other) noexcept;
253
263 Smartcard& operator=(Smartcard&& other) noexcept;
264 private:
265 class Impl;
266 std::unique_ptr<Smartcard::Impl> pimpl;
267 };
268 }
269}
270#endif /* __BE_DEVICE_SMARTCARD_H__ */
271
Representation of a single ISO 7816 smartcard in the system.
void setDryrun(bool state)
Set the 'dryrun' state.
Smartcard & operator=(Smartcard &&other) noexcept
Move assignment.
Smartcard(unsigned int cardNum)
Connect to the Nth card in the system independent of any application installed on the card.
Smartcard(Smartcard &&other) noexcept
Move constructor.
Memory::uint8Array getLastAPDU() const
Obtain a copy of the last APDU sent to the card.
Smartcard(unsigned int cardNum, const Memory::uint8Array &appID)
Connect to the Nth card in the system and activate the application with the given identifier.
APDUResponse sendAPDU(Device::Smartcard::APDU &apdu)
Send an APDU to a card using the best transmission method available for the card.
Memory::uint8Array getDedicatedFileObject(const Memory::uint8Array &objectID)
Read a data object from the application dedicated file.
std::string getReaderID() const
Obtain the identifier of the reader that the smartcard is plugged into.
Memory::uint8Array getLastResponseData() const
Obtain a copy of the last response data returned from the card.
This software was developed at the National Institute of Standards and Technology (NIST) by employees...
APDUResponse response
The partial response data and status words from the failed command.
APDUException(const APDUResponse &response, const Memory::uint8Array &apdu)
Constructor.
Memory::uint8Array apdu
The raw APDU that was sent.
The data and status words returned by the card in response to a command.
APDUResponse(const Memory::uint8Array &data, const uint8_t sw1, const uint8_t sw2)
Constructor.
Memory::uint8Array data
The response data, possibly incomplete.