LibLogicalAccess  2.5.0
An Open Source RFID Library
Loading...
Searching...
No Matches
iso7816iso7816commands.hpp
Go to the documentation of this file.
1
7#ifndef LOGICALACCESS_ISO7816ISO7816COMMANDS_HPP
8#define LOGICALACCESS_ISO7816ISO7816COMMANDS_HPP
9
14
15#include <string>
16#include <vector>
17#include <iostream>
18
19namespace logicalaccess
20{
21#define CMD_ISO7816ISO7816 "ISO7816ISO7816"
22
23#define ISO7816_CLA_ISO_COMPATIBLE 0x00
24#define ISO7816_INS_APPEND_RECORD 0xE2
25#define ISO7816_INS_GET_CHALLENGE 0x84
26#define ISO7816_INS_READ_RECORDS 0xB2
27#define ISO7816_INS_EXTERNAL_AUTHENTICATE 0x82
28#define ISO7816_INS_INTERNAL_AUTHENTICATE 0x88
29#define ISO7816_INS_GENERAL_AUTHENTICATE 0x87
30#define ISO7816_INS_SELECT_FILE 0xA4
31#define ISO7816_INS_READ_BINARY 0xB0
32#define ISO7816_INS_WRITE_BINARY 0xD0
33#define ISO7816_INS_UPDATE_BINARY 0xD6
34#define ISO7816_INS_ERASE_BINARY 0x0E
35#define ISO7816_INS_GET_RESPONSE 0xC0
36#define ISO7816_INS_GET_DATA 0xCA
37#define ISO7816_INS_GET_DATA_LIST 0xCB
38#define ISO7816_INS_PUT_DATA 0xDA
39#define ISO7816_INS_APPLICATION_MANAGEMENT_REQUEST 0x41
40#define ISO7816_INS_REMOVE_APPLICATION 0xED
41
45class LLA_READERS_ISO7816_API ISO7816ISO7816Commands : public ISO7816Commands
46{
47 public:
52
53 explicit ISO7816ISO7816Commands(std::string);
54
59
68 ByteVector readBinary(size_t length, size_t offset, unsigned short efid = 0) override;
69
78 void writeBinary(const ByteVector &data, size_t offset,
79 unsigned short efid = 0) override;
80
89 void updateBinary(const ByteVector &data, size_t offset,
90 unsigned short efid = 0) override;
91
98 void eraseBinary(size_t offset, unsigned short efid = 0) override;
99
107 ByteVector getData(unsigned short dataObject, size_t length) override;
108
115 ByteVector getDataList(const ByteVector &data, size_t length,
116 unsigned short efid = ISO7816_DATA_OBJECT_SELECTED) override;
117
125 void putData(const ByteVector &data, unsigned short dataObject) override;
126
132 ByteVector getResponse(unsigned char maxlength = 0) override;
133
141 void selectFile(unsigned char p1, unsigned char p2, const ByteVector &data) override;
142
150 ByteVector readRecords(unsigned short fid = 0, unsigned char start_record = 0,
151 ISORecords record_number = ISO_RECORD_ONERECORD) override;
152
158 void appendrecord(const ByteVector &data = ByteVector(),
159 unsigned short fid = 0) override;
160
166 ByteVector getChallenge(unsigned int length = 8) override;
167
175 void externalAuthenticate(unsigned char algorithm = 0x00,
176 bool globalReference = false, unsigned char keyno = 0x00,
177 const ByteVector &data = ByteVector()) override;
178
188 ByteVector externalAuthenticate(unsigned char algorithm,
189 bool globalReference, unsigned char keyno,
190 const ByteVector &data,
191 unsigned char le) override;
192
203 ByteVector internalAuthenticate(unsigned char algorithm = 0x00,
204 bool globalReference = false,
205 unsigned char keyno = 0x00,
206 const ByteVector &RPCD2 = ByteVector(),
207 unsigned int length = 16) override;
208
219 ByteVector generalAuthenticate(unsigned char algorithm, bool globalReference,
220 unsigned char keyno,
221 const ByteVector &dataField,
222 unsigned char le) override;
223
224 ByteVector generalAuthenticate_challenge(unsigned char algorithm,
225 bool globalReference,
226 unsigned char keyno) override;
227
228 ByteVector generalAuthenticate_response(unsigned char algorithm,
229 bool globalReference,
230 unsigned char keyno,
231 const ByteVector &data) override;
232
233 void removeApplication(
234 const ByteVector &data,
237
238 ByteVector applicationManagementRequest(
239 const ByteVector &data,
241 unsigned char p2 = 0x00) override;
242
247 std::shared_ptr<ISO7816ReaderCardAdapter> getISO7816ReaderCardAdapter() const
248 {
249 return std::dynamic_pointer_cast<ISO7816ReaderCardAdapter>(
250 getReaderCardAdapter());
251 }
252
253 protected:
261 static void setP1P2(size_t offset, unsigned short efid, unsigned char &p1, unsigned char &p2);
262};
263} // namespace logicalaccess
264
265#endif
The ISO7816 commands class.
Definition: iso7816commands.hpp:105
The ISO7816 commands base class.
Definition: iso7816iso7816commands.hpp:46
std::shared_ptr< ISO7816ReaderCardAdapter > getISO7816ReaderCardAdapter() const
Get the ISO7816 reader/card adapter.
Definition: iso7816iso7816commands.hpp:247
ISO7816 commands. See http://www.cardwerk.com/smartcards/smartcard_standard_ISO7816-4....
#define ISO7816_DATA_OBJECT_SELECTED
Definition: iso7816commands.hpp:84
Default ISO7816 reader/card adapter.
std::vector< uint8_t > ByteVector
Definition: lla_fwd.hpp:80
Definition: asn1.hpp:9
ISORemoveApplicationP1
The P1 of Remove Application command.
Definition: iso7816commands.hpp:53
@ P1_STATE_OPERATIONAL_OR_INITIALIZATION_TO_CREATION
Definition: iso7816commands.hpp:58
ISORecords
The ISO record transmission mode.
Definition: iso7816commands.hpp:79
@ ISO_RECORD_ONERECORD
Definition: iso7816commands.hpp:80
ISOApplicationManagementRequestP1
The P1 of Application Management Request command.
Definition: iso7816commands.hpp:66
@ P1_STATE_CREATION_TO_OPERATIONAL
Definition: iso7816commands.hpp:71