7#ifndef LOGICALACCESS_DESFIREEV1ISO7816COMMANDS_HPP
8#define LOGICALACCESS_DESFIREEV1ISO7816COMMANDS_HPP
13#include <logicalaccess/plugins/readers/iso7816/lla_readers_iso7816_api.hpp>
20#define DESFIREEV1_CLEAR_DATA_LENGTH_CHUNK 60
21#define CMD_DESFIREEV1ISO7816 "DESFireEV1ISO7816"
49 unsigned int getFreeMem()
override;
55 std::vector<DFName> getDFNames()
override;
62 std::vector<unsigned short> getISOFileIDs()
override;
64 using DESFireISO7816Commands::createApplication;
76 unsigned short isoFID = 0x00,
79 using DESFireISO7816Commands::getKeySettings;
97 using DESFireISO7816Commands::createStdDataFile;
107 void createStdDataFile(
unsigned char fileno,
EncryptionMode comSettings,
109 unsigned short isoFID)
override;
111 using DESFireISO7816Commands::createBackupFile;
121 void createBackupFile(
unsigned char fileno,
EncryptionMode comSettings,
123 unsigned short isoFID)
override;
125 using DESFireISO7816Commands::createLinearRecordFile;
136 void createLinearRecordFile(
unsigned char fileno,
EncryptionMode comSettings,
138 unsigned int fileSize,
unsigned int maxNumberOfRecords,
139 unsigned short isoFID)
override;
141 using DESFireISO7816Commands::createCyclicRecordFile;
152 void createCyclicRecordFile(
unsigned char fileno,
EncryptionMode comSettings,
154 unsigned int fileSize,
unsigned int maxNumberOfRecords,
155 unsigned short isoFID)
override;
165 virtual void iso_authenticate(std::shared_ptr<DESFireKey> key,
167 bool isMasterCardKey =
true,
168 unsigned char keyno = 0x00);
171 void pkcs_iso_authenticate(std::shared_ptr<DESFireKey> key,
172 bool isMasterCardKey =
true,
unsigned char keyno = 0x00);
179 void authenticate(
unsigned char keyno, std::shared_ptr<DESFireKey> key)
override;
186 void authenticateISO(
unsigned char keyno,
193 void authenticateAES(
unsigned char keyno)
override;
194 void iks_authenticateAES(std::shared_ptr<DESFireKey> key, uint8_t keyno);
204 ByteVector readData(
unsigned char fileno,
unsigned int offset,
unsigned int length,
216 ByteVector readRecords(
unsigned char fileno,
unsigned int offset,
unsigned int length,
226 void changeFileSettings(
unsigned char fileno,
EncryptionMode comSettings,
240 void changeKey(
unsigned char keyno, std::shared_ptr<DESFireKey> key)
override;
252 std::vector<unsigned int> getApplicationIDs()
override;
267 int32_t getValue(
unsigned char fileno,
EncryptionMode mode)
override;
274 void setConfiguration(
bool formatCardEnabled,
bool randomIdEnabled)
override;
280 void setConfiguration(std::shared_ptr<DESFireKey> defaultKey)
override;
286 void setConfiguration(
const ByteVector &ats)
override;
288 virtual void sam_iso_authenticate(std::shared_ptr<DESFireKey> key,
290 unsigned char keyno);
297 virtual void iks_iso_authenticate(std::shared_ptr<DESFireKey> key,
298 bool isMasterCardKey, uint8_t keyno);
300 MyDivInfo extract_iks_div_info(std::shared_ptr<Key> key, uint8_t keyno);
302 void selectApplication(
unsigned int aid)
override;
308 std::shared_ptr<Chip>
getChip()
const override
310 return DESFireISO7816Commands::getChip();
319 return DESFireISO7816Commands::getReaderCardAdapter();
324 auto command = std::make_shared<ISO7816ISO7816Commands>();
325 command->setChip(getChip());
326 command->setReaderCardAdapter(getReaderCardAdapter());
369 void handleWriteData(
unsigned char cmd,
const ByteVector ¶meters,
381 unsigned char lc = 0,
bool forceLc =
false)
override;
389 virtual ISO7816Response transmit_plain(
unsigned char cmd,
unsigned char lc);
401 unsigned char lc = 0,
bool forceLc =
false);
409 virtual ISO7816Response transmit_nomacv(
unsigned char cmd,
unsigned char lc);
421 unsigned char lc = 0,
bool forceLc =
false);
426 void onAuthenticated();
The DESFire EV1 base commands class.
Definition: desfireev1commands.hpp:76
The DESFire EV1 base commands class.
Definition: desfireev1iso7816commands.hpp:31
SignatureResult handle_read_data_last_sig_
Definition: desfireev1iso7816commands.hpp:429
std::shared_ptr< ReaderCardAdapter > getReaderCardAdapter() const override
Get the reader/card adapter.
Definition: desfireev1iso7816commands.hpp:317
std::shared_ptr< Chip > getChip() const override
Get the chip.
Definition: desfireev1iso7816commands.hpp:308
std::shared_ptr< ISO7816Commands > getISO7816Commands() const override
Definition: desfireev1iso7816commands.hpp:322
The DESFire base commands class.
Definition: desfireiso7816commands.hpp:30
A ISO7816 response message.
Definition: iso7816response.hpp:21
std::vector< uint8_t > ByteVector
Definition: lla_fwd.hpp:80
FidSupport
The FID Support for ISO 7816.
Definition: desfireev1commands.hpp:49
@ FIDS_NO_ISO_FID
Definition: desfireev1commands.hpp:49
EncryptionMode
The file communication mode (or encryption mode)
Definition: desfirelocation.hpp:18
DESFireKeySettings
The key settings.
Definition: desfirecommands.hpp:69
DESFireISOAlgorithm
The DESFire EV1 algorithm.
Definition: desfireev1commands.hpp:63
@ DF_ALG_2K3DES
Definition: desfireev1commands.hpp:65
DESFireKeyType
The DESFire key type.
Definition: desfirekey.hpp:33
Access rights on DESFire file.
Definition: desfirecommands.hpp:106
Card information about software and hardware version.
Definition: desfirecommands.hpp:212
Definition: RemoteCrypto.hpp:24
Definition: RemoteCrypto.hpp:9