8#ifndef LOGICALACCESS_ISO7816COMMANDS_HPP
9#define LOGICALACCESS_ISO7816COMMANDS_HPP
18#define CMD_ISO7816 "ISO7816"
84#define ISO7816_DATA_OBJECT_SELECTED 0x3FFF
85#define ISO7816_DATA_OBJECT_EXTENDED_HEADERLIST 0x4D
86#define ISO7816_DATA_OBJECT_HEADERLIST 0x5C
87#define ISO7816_DATA_OBJECT_TAGLIST 0x5D
88#define ISO7816_DATA_OBJECT_APPLICATION_TEMPLATE 0x61
89#define ISO7816_DATA_OBJECT_DYNAMIC_AUTHENTICATION_DATA 0x7C
90#define ISO7816_DATA_OBJECT_WITNESS 0x80
91#define ISO7816_DATA_OBJECT_CHALLENGE 0x81
92#define ISO7816_DATA_OBJECT_RESPONSE 0x82
93#define IS7816O_DATA_OBJECT_COMMITTED 0x83
94#define ISO7816_DATA_OBJECT_AUTHCODE 0x84
95#define ISO7816_DATA_OBJECT_CRYPTOGRAM 0x85
96#define ISO7816_DATA_OBJECT_CRYPTOGRAPHIC_CHECKSUM 0x8E
97#define ISO7816_DATA_OBJECT_PROTECTED_NE 0x97
98#define ISO7816_DATA_OBJECT_PROCESSING_STATUS 0x99
99#define ISO7816_DATA_OBJECT_IDENTIFICATION_DATA_TEMPLATE 0xA0
128 unsigned short efid = 0) = 0;
138 unsigned short efid = 0) = 0;
148 unsigned short efid = 0) = 0;
155 virtual void eraseBinary(
size_t offset,
unsigned short efid = 0) = 0;
174 virtual ByteVector getDataList(int64_t dataObject,
224 virtual void selectFile(
unsigned short efid);
230 virtual void selectFile(
const ByteVector &dfname);
249 ISORecords record_number = ISO_RECORD_ONERECORD) = 0;
257 unsigned short fid = 0) = 0;
274 bool globalReference =
false,
275 unsigned char keyno = 0x00,
289 unsigned char le) = 0;
299 bool globalReference =
false,
300 unsigned char keyno = 0x00,
302 unsigned int length = 16) = 0;
317 unsigned char le) = 0;
320 unsigned char keyno) = 0;
323 bool globalReference,
unsigned char keyno,
328 P1_STATE_OPERATIONAL_OR_INITIALIZATION_TO_CREATION) = 0;
330 virtual void removeApplication(
TLVPtr tlv,
332 P1_STATE_OPERATIONAL_OR_INITIALIZATION_TO_CREATION);
337 unsigned char p2 = 0x00) = 0;
339 virtual ByteVector applicationManagementRequest(
342 unsigned char p2 = 0x00);
The base commands class for all card commands.
Definition: commands.hpp:21
The ISO7816 commands class.
Definition: iso7816commands.hpp:105
virtual ByteVector generalAuthenticate_challenge(unsigned char algorithm, bool globalReference, unsigned char keyno)=0
virtual ByteVector generalAuthenticate_response(unsigned char algorithm, bool globalReference, unsigned char keyno, const ByteVector &data)=0
virtual ByteVector externalAuthenticate(unsigned char algorithm, bool globalReference, unsigned char keyno, const ByteVector &data, unsigned char le)=0
ISO external authenticate.
virtual ByteVector applicationManagementRequest(const ByteVector &data, ISOApplicationManagementRequestP1 p1=P1_STATE_CREATION_TO_OPERATIONAL, unsigned char p2=0x00)=0
virtual ByteVector readRecords(unsigned short fid=0, unsigned char start_record=0, ISORecords record_number=ISO_RECORD_ONERECORD)=0
Read records.
virtual void selectFile(unsigned char p1, unsigned char p2, const ByteVector &data)=0
Select a file.
virtual ByteVector getDataList(const ByteVector &data, size_t length=0, unsigned short efid=ISO7816_DATA_OBJECT_SELECTED)=0
Get data.
ISO7816Commands(std::string ct)
Definition: iso7816commands.hpp:112
virtual ByteVector getChallenge(unsigned int length=8)=0
Get the ISO challenge for authentication.
virtual void appendrecord(const ByteVector &data=ByteVector(), unsigned short fid=0)=0
Append a record to a file.
virtual void eraseBinary(size_t offset, unsigned short efid=0)=0
Erase binary data.
virtual ByteVector internalAuthenticate(unsigned char algorithm=0x00, bool globalReference=false, unsigned char keyno=0x00, const ByteVector &RPCD2=ByteVector(), unsigned int length=16)=0
ISO internal authenticate.
virtual void writeBinary(const ByteVector &data, size_t offset, unsigned short efid=0)=0
Write binary data.
virtual void updateBinary(const ByteVector &data, size_t offset, unsigned short efid=0)=0
Update binary data.
virtual ByteVector getData(unsigned short dataObject, size_t length=0)=0
Get data.
virtual ByteVector getResponse(unsigned char maxlength=0)=0
Get response.
virtual void removeApplication(const ByteVector &data, ISORemoveApplicationP1 p1=P1_STATE_OPERATIONAL_OR_INITIALIZATION_TO_CREATION)=0
virtual ByteVector readBinary(size_t length, size_t offset, unsigned short efid=0)=0
Read binary data.
virtual void externalAuthenticate(unsigned char algorithm=0x00, bool globalReference=false, unsigned char keyno=0x00, const ByteVector &data=ByteVector())=0
ISO external authenticate.
virtual ByteVector generalAuthenticate(unsigned char algorithm, bool globalReference, unsigned char keyno, const ByteVector &dataField, unsigned char le)=0
ISO general authenticate.
ISO7816Commands()
Definition: iso7816commands.hpp:107
virtual void putData(const ByteVector &data, unsigned short dataObject)=0
Put data.
#define ISO7816_DATA_OBJECT_HEADERLIST
Definition: iso7816commands.hpp:86
#define CMD_ISO7816
Definition: iso7816commands.hpp:18
#define ISO7816_DATA_OBJECT_SELECTED
Definition: iso7816commands.hpp:84
std::vector< uint8_t > ByteVector
Definition: lla_fwd.hpp:80
ISORemoveApplicationP1
The P1 of Remove Application command.
Definition: iso7816commands.hpp:53
@ P1_STATE_OPERATIONAL_TO_CREATION
Definition: iso7816commands.hpp:57
@ P1_STATE_OPERATIONAL_OR_INITIALIZATION_TO_CREATION
Definition: iso7816commands.hpp:58
@ P1_STATE_INITIALIZATION_TO_CREATION
Definition: iso7816commands.hpp:55
@ P1_STATE_CREATION_TO_APPLICATION_REMOVED
Definition: iso7816commands.hpp:54
@ P1_STATE_OPERATIONAL_TO_APPLICATION_REMOVED
Definition: iso7816commands.hpp:59
@ P1_STATE_INITIALIZATION_TO_APPLICATION_REMOVED
Definition: iso7816commands.hpp:56
ISORecords
The ISO record transmission mode.
Definition: iso7816commands.hpp:79
@ ISO_RECORD_ONERECORD
Definition: iso7816commands.hpp:80
@ ISO_RECORD_ALLRECORDS
Definition: iso7816commands.hpp:81
std::shared_ptr< TLV > TLVPtr
Definition: lla_fwd.hpp:77
ISOApplicationManagementRequestP1
The P1 of Application Management Request command.
Definition: iso7816commands.hpp:66
@ P1_STATE_INITIALIZATION_TO_OPERATIONAL
Definition: iso7816commands.hpp:70
@ P1_STATE_NONEXISTENT_TO_OPERATIONAL
Definition: iso7816commands.hpp:72
@ P1_STATE_NONEXISTENT_TO_CREATION
Definition: iso7816commands.hpp:67
@ P1_STATE_CREATION_TO_INITIALIZATION
Definition: iso7816commands.hpp:68
@ P1_STATE_CREATION_TO_OPERATIONAL
Definition: iso7816commands.hpp:71
@ P1_STATE_NONEXISTENT_TO_INITIALIZATION
Definition: iso7816commands.hpp:69
ISOSelectFileP1
The P1 of Select File command.
Definition: iso7816commands.hpp:24
@ P1_SELECT_MF_DF_EF
Definition: iso7816commands.hpp:25
@ P1_SELECT_PATH_FROM_MF
Definition: iso7816commands.hpp:30
@ P1_SELECT_PATH_FROM_CURRENT_DF
Definition: iso7816commands.hpp:31
@ P1_SELECT_EF_UNDER_CURRENT_DF
Definition: iso7816commands.hpp:27
@ P1_SELECT_BY_DFNAME
Definition: iso7816commands.hpp:29
@ P1_SELECT_PARENT_DF_OF_CURRENT_DF
Definition: iso7816commands.hpp:28
@ P1_SELECT_CHILD_DF
Definition: iso7816commands.hpp:26
ISOSelectFileP2
The P2 of Select File command.
Definition: iso7816commands.hpp:38
@ P2_FIRST_RECORD
Definition: iso7816commands.hpp:39
@ P2_LAST_RECORD
Definition: iso7816commands.hpp:40
@ P2_RETURN_NO_FCI
Definition: iso7816commands.hpp:46
@ P2_RETURN_FCP
Definition: iso7816commands.hpp:44
@ P2_PREVIOUS_RECORD
Definition: iso7816commands.hpp:42
@ P2_RETURN_FMD
Definition: iso7816commands.hpp:45
@ P2_NEXT_RECORD
Definition: iso7816commands.hpp:41