LibLogicalAccess  2.5.0
An Open Source RFID Library
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
logicalaccess::DESFireEV1ISO7816Commands Class Reference

The DESFire EV1 base commands class. More...

#include <desfireev1iso7816commands.hpp>

Inheritance diagram for logicalaccess::DESFireEV1ISO7816Commands:
logicalaccess::DESFireISO7816Commands logicalaccess::DESFireEV1Commands logicalaccess::DESFireCommands logicalaccess::ICommands logicalaccess::Commands logicalaccess::ICommands

Public Member Functions

 DESFireEV1ISO7816Commands ()
 Constructor.
 
 DESFireEV1ISO7816Commands (std::string ct)
 
virtual ~DESFireEV1ISO7816Commands ()
 Destructor.
 
unsigned int getFreeMem () override
 Get the value of available bytes.
 
std::vector< DFNamegetDFNames () override
 Get the ISO DF-Names of all active application.
 
std::vector< unsigned short > getISOFileIDs () override
 Get the ISO FID of all active files within the currently selected application.
 
void createApplication (unsigned int aid, DESFireKeySettings settings, unsigned char maxNbKeys, DESFireKeyType cryptoMethod, FidSupport fidSupported=FIDS_NO_ISO_FID, unsigned short isoFID=0x00, ByteVector isoDFName=ByteVector()) override
 Create a new application.
 
void getKeySettings (DESFireKeySettings &settings, unsigned char &maxNbKeys, DESFireKeyType &keyType) override
 Get key settings on the current application.
 
ByteVector getCardUID () override
 Get a random card UID.
 
void createStdDataFile (unsigned char fileno, EncryptionMode comSettings, const DESFireAccessRights &accessRights, unsigned int fileSize, unsigned short isoFID) override
 Create a new data file in the current application.
 
void createBackupFile (unsigned char fileno, EncryptionMode comSettings, const DESFireAccessRights &accessRights, unsigned int fileSize, unsigned short isoFID) override
 Create a new backup file in the current application.
 
void createLinearRecordFile (unsigned char fileno, EncryptionMode comSettings, const DESFireAccessRights &accessRights, unsigned int fileSize, unsigned int maxNumberOfRecords, unsigned short isoFID) override
 Create a new linear record file in the current application.
 
void createCyclicRecordFile (unsigned char fileno, EncryptionMode comSettings, const DESFireAccessRights &accessRights, unsigned int fileSize, unsigned int maxNumberOfRecords, unsigned short isoFID) override
 Create a new cyclic record file in the current application.
 
virtual void iso_authenticate (std::shared_ptr< DESFireKey > key, DESFireISOAlgorithm algorithm=DF_ALG_2K3DES, bool isMasterCardKey=true, unsigned char keyno=0x00)
 ISO authenticate.
 
void pkcs_iso_authenticate (std::shared_ptr< DESFireKey > key, bool isMasterCardKey=true, unsigned char keyno=0x00)
 
void authenticate (unsigned char keyno, std::shared_ptr< DESFireKey > key) override
 Authenticate, given a key number.
 
void authenticateISO (unsigned char keyno, DESFireISOAlgorithm algorithm=DF_ALG_2K3DES) override
 AuthenticateISO command.
 
void authenticateAES (unsigned char keyno) override
 AuthenticateAES command.
 
void iks_authenticateAES (std::shared_ptr< DESFireKey > key, uint8_t keyno)
 
ByteVector readData (unsigned char fileno, unsigned int offset, unsigned int length, EncryptionMode mode) override
 Read data from a specific file.
 
ByteVector readRecords (unsigned char fileno, unsigned int offset, unsigned int length, EncryptionMode mode) override
 Read record from a specific record file.
 
void changeFileSettings (unsigned char fileno, EncryptionMode comSettings, const DESFireAccessRights &accessRights, bool plain) override
 Change file settings of a specific file in the current application.
 
void changeKeySettings (DESFireKeySettings settings) override
 Change key settings for the current application.
 
void changeKey (unsigned char keyno, std::shared_ptr< DESFireKey > key) override
 Change a key in the current application.
 
DESFireCardVersion getVersion () override
 Get the card version information.
 
std::vector< unsigned int > getApplicationIDs () override
 Get the current application list.
 
ByteVector getFileIDs () override
 Get the File IDentifiers of all active files within the currently selected application.
 
int32_t getValue (unsigned char fileno, EncryptionMode mode) override
 Get value from a specific value file.
 
void setConfiguration (bool formatCardEnabled, bool randomIdEnabled) override
 Set the card configuration.
 
void setConfiguration (std::shared_ptr< DESFireKey > defaultKey) override
 Set the card configuration default key. param defaultKey The new default key.
 
void setConfiguration (const ByteVector &ats) override
 Set a custom card ATS.
 
virtual void sam_iso_authenticate (std::shared_ptr< DESFireKey > key, DESFireISOAlgorithm algorithm, bool isMasterCardKey, unsigned char keyno)
 
virtual void iks_iso_authenticate (std::shared_ptr< DESFireKey > key, bool isMasterCardKey, uint8_t keyno)
 
MyDivInfo extract_iks_div_info (std::shared_ptr< Key > key, uint8_t keyno)
 
void selectApplication (unsigned int aid) override
 Select an application.
 
std::shared_ptr< ChipgetChip () const override
 Get the chip.
 
std::shared_ptr< ReaderCardAdaptergetReaderCardAdapter () const override
 Get the reader/card adapter.
 
std::shared_ptr< ISO7816CommandsgetISO7816Commands () const override
 
SignatureResult IKS_getLastReadSignature () const override
 
void createApplication (unsigned int aid, DESFireKeySettings settings, unsigned char maxNbKeys) override
 Create a new application.
 
void getKeySettings (DESFireKeySettings &settings, unsigned char &maxNbKeys) override
 Get key settings on the current application.
 
void createStdDataFile (unsigned char fileno, EncryptionMode comSettings, const DESFireAccessRights &accessRights, unsigned int fileSize) override
 Create a new data file in the current application.
 
void createBackupFile (unsigned char fileno, EncryptionMode comSettings, const DESFireAccessRights &accessRights, unsigned int fileSize) override
 Create a new backup file in the current application.
 
void createLinearRecordFile (unsigned char fileno, EncryptionMode comSettings, const DESFireAccessRights &accessRights, unsigned int fileSize, unsigned int maxNumberOfRecords) override
 Create a new linear record file in the current application.
 
void createCyclicRecordFile (unsigned char fileno, EncryptionMode comSettings, const DESFireAccessRights &accessRights, unsigned int fileSize, unsigned int maxNumberOfRecords) override
 Create a new cyclic record file in the current application.
 
- Public Member Functions inherited from logicalaccess::DESFireISO7816Commands
 DESFireISO7816Commands ()
 Constructor.
 
 DESFireISO7816Commands (std::string)
 
virtual ~DESFireISO7816Commands ()
 Destructor.
 
void setChip (std::shared_ptr< Chip > chip) override
 
void erase () override
 Erase the card.
 
void selectApplication (unsigned int aid) override
 Select an application.
 
void createApplication (unsigned int aid, DESFireKeySettings settings, unsigned char maxNbKeys) override
 Create a new application.
 
void deleteApplication (unsigned int aid) override
 Delete an application.
 
std::vector< unsigned int > getApplicationIDs () override
 Get the current application list.
 
void changeKey (unsigned char keyno, std::shared_ptr< DESFireKey > key) override
 Change a key in the current application.
 
void getKeySettings (DESFireKeySettings &settings, unsigned char &maxNbKeys) override
 Get key settings on the current application.
 
virtual uint8_t getKeyVersion (uint8_t keyno)
 Get a key version of a key.
 
void changeKeySettings (DESFireKeySettings settings) override
 Change key settings for the current application.
 
ByteVector getFileIDs () override
 Get the File IDentifiers of all active files within the currently selected application.
 
FileSetting getFileSettings (unsigned char fileno) override
 Get settings of a specific file in the current application.
 
void changeFileSettings (unsigned char fileno, EncryptionMode comSettings, const DESFireAccessRights &accessRights, bool plain) override
 Change file settings of a specific file in the current application.
 
void createStdDataFile (unsigned char fileno, EncryptionMode comSettings, const DESFireAccessRights &accessRights, unsigned int fileSize) override
 Create a new data file in the current application.
 
void createBackupFile (unsigned char fileno, EncryptionMode comSettings, const DESFireAccessRights &accessRights, unsigned int fileSize) override
 Create a new backup file in the current application.
 
void createValueFile (unsigned char fileno, EncryptionMode comSettings, const DESFireAccessRights &accessRights, int32_t lowerLimit, int32_t upperLimit, int32_t value, bool limitedCreditEnabled) override
 Create a new value file in the current application.
 
void createLinearRecordFile (unsigned char fileno, EncryptionMode comSettings, const DESFireAccessRights &accessRights, unsigned int fileSize, unsigned int maxNumberOfRecords) override
 Create a new linear record file in the current application.
 
void createCyclicRecordFile (unsigned char fileno, EncryptionMode comSettings, const DESFireAccessRights &accessRights, unsigned int fileSize, unsigned int maxNumberOfRecords) override
 Create a new cyclic record file in the current application.
 
void deleteFile (unsigned char fileno) override
 Delete a file in the current application.
 
ByteVector readData (unsigned char fileno, unsigned int offset, unsigned int length, EncryptionMode mode) override
 Read data from a specific file.
 
void writeData (unsigned char fileno, unsigned int offset, const ByteVector &data, EncryptionMode mode) override
 Write data into a specific file.
 
int32_t getValue (unsigned char fileno, EncryptionMode mode) override
 Get value from a specific value file.
 
void credit (unsigned char fileno, unsigned int value, EncryptionMode mode) override
 Credit a specific value file.
 
void debit (unsigned char fileno, unsigned int value, EncryptionMode mode) override
 Debit a specific value file.
 
void limitedCredit (unsigned char fileno, int32_t value, EncryptionMode mode) override
 Limit credit on a specific value file.
 
void writeRecord (unsigned char fileno, unsigned int offset, const ByteVector &data, EncryptionMode mode) override
 Write record into a specific record file.
 
ByteVector readRecords (unsigned char fileno, unsigned int offset, unsigned int length, EncryptionMode mode) override
 Read record from a specific record file.
 
void clearRecordFile (unsigned char fileno) override
 Clear a specific record file.
 
void commitTransaction () override
 Commit the transaction.
 
void abortTransaction () override
 Abort the transaction.
 
void authenticate (unsigned char keyno=0) override
 Authenticate, given a key number.
 
void authenticate (unsigned char keyno, std::shared_ptr< DESFireKey > key) override
 Authenticate, given a key number.
 
DESFireCardVersion getVersion () override
 Get the card version information.
 
std::shared_ptr< ISO7816ReaderCardAdaptergetISO7816ReaderCardAdapter () const
 Get the ISO7816 reader/card adapter.
 
void setSAMChip (std::shared_ptr< SAMChip > t)
 Set the SAM Chip.
 
std::shared_ptr< SAMChipgetSAMChip () const
 get the SAM Chip.
 
void getKeyFromSAM (std::shared_ptr< DESFireKey > key, ByteVector diversify) const
 retrieve key from SAM AV2 dump key.
 
ByteVector sam_authenticate_p1 (std::shared_ptr< DESFireKey > key, ByteVector rndb, ByteVector diversify) const
 
void sam_authenticate_p2 (unsigned char keyno, ByteVector rndap) const
 
- Public Member Functions inherited from logicalaccess::DESFireCommands
 DESFireCommands ()
 Constructor.
 
 DESFireCommands (std::string cmdtype)
 Constructor.
 
virtual ~DESFireCommands ()
 
virtual void erase ()=0
 Erase the card.
 
virtual void selectApplication (std::shared_ptr< DESFireLocation > location)
 Select an application.
 
virtual void createApplication (std::shared_ptr< DESFireLocation > location, DESFireKeySettings settings, unsigned char maxNbKeys)
 Create a new application.
 
virtual void createStdDataFile (std::shared_ptr< DESFireLocation > location, const DESFireAccessRights &accessRights, unsigned int fileSize)
 Create a new data file in the current application.
 
virtual EncryptionMode getEncryptionMode (unsigned char fileno, bool isReadMode, bool *needLoadKey=nullptr)
 Get the communication mode for a file.
 
virtual EncryptionMode getEncryptionMode (const FileSetting &fileSetting, bool isReadMode, bool *needLoadKey=nullptr)
 
virtual unsigned int getFileLength (unsigned char fileno)
 Get the length of a file.
 
virtual void selectApplication (unsigned int aid)=0
 Select an application.
 
virtual void createApplication (unsigned int aid, DESFireKeySettings settings, unsigned char maxNbKeys)=0
 Create a new application.
 
virtual void deleteApplication (unsigned int aid)=0
 Delete an application.
 
virtual std::vector< unsigned int > getApplicationIDs ()=0
 Get the current application list.
 
virtual void changeKey (unsigned char keyno, std::shared_ptr< DESFireKey > key)=0
 Change a key in the current application.
 
virtual void getKeySettings (DESFireKeySettings &settings, unsigned char &maxNbKeys)=0
 Get key settings on the current application.
 
virtual void changeKeySettings (DESFireKeySettings settings)=0
 Change key settings for the current application.
 
virtual ByteVector getFileIDs ()=0
 Get the File IDentifiers of all active files within the currently selected application.
 
virtual FileSetting getFileSettings (unsigned char fileno)=0
 Get settings of a specific file in the current application.
 
virtual void changeFileSettings (unsigned char fileno, EncryptionMode comSettings, const DESFireAccessRights &accessRights, bool plain)=0
 Change file settings of a specific file in the current application.
 
virtual void createStdDataFile (unsigned char fileno, EncryptionMode comSettings, const DESFireAccessRights &accessRights, unsigned int fileSize)=0
 Create a new data file in the current application.
 
virtual void createBackupFile (unsigned char fileno, EncryptionMode comSettings, const DESFireAccessRights &accessRights, unsigned int fileSize)=0
 Create a new backup file in the current application.
 
virtual void createValueFile (unsigned char fileno, EncryptionMode comSettings, const DESFireAccessRights &accessRights, int32_t lowerLimit, int32_t upperLimit, int32_t value, bool limitedCreditEnabled)=0
 Create a new value file in the current application.
 
virtual void createLinearRecordFile (unsigned char fileno, EncryptionMode comSettings, const DESFireAccessRights &accessRights, unsigned int fileSize, unsigned int maxNumberOfRecords)=0
 Create a new linear record file in the current application.
 
virtual void createCyclicRecordFile (unsigned char fileno, EncryptionMode comSettings, const DESFireAccessRights &accessRights, unsigned int fileSize, unsigned int maxNumberOfRecords)=0
 Create a new cyclic record file in the current application.
 
virtual void deleteFile (unsigned char fileno)=0
 Delete a file in the current application.
 
virtual ByteVector readData (unsigned char fileno, unsigned int offset, unsigned int length, EncryptionMode mode)=0
 Read data from a specific file.
 
virtual void writeData (unsigned char fileno, unsigned int offset, const ByteVector &data, EncryptionMode mode)=0
 Write data into a specific file.
 
virtual int32_t getValue (unsigned char fileno, EncryptionMode mode)=0
 Get value from a specific value file.
 
virtual void credit (unsigned char fileno, unsigned int value, EncryptionMode mode)=0
 Credit a specific value file.
 
virtual void debit (unsigned char fileno, unsigned int value, EncryptionMode mode)=0
 Debit a specific value file.
 
virtual void limitedCredit (unsigned char fileno, int32_t value, EncryptionMode mode)=0
 Limit credit on a specific value file.
 
virtual void writeRecord (unsigned char fileno, unsigned int offset, const ByteVector &data, EncryptionMode mode)=0
 Write record into a specific record file.
 
virtual ByteVector readRecords (unsigned char fileno, unsigned int offset, unsigned int length, EncryptionMode mode)=0
 Read record from a specific record file.
 
virtual void clearRecordFile (unsigned char fileno)=0
 Clear a specific record file.
 
virtual void commitTransaction ()=0
 Commit the transaction.
 
virtual void abortTransaction ()=0
 Abort the transaction.
 
virtual void authenticate (unsigned char keyno=0)=0
 Authenticate a block, given a key number.
 
virtual void authenticate (unsigned char keyno, std::shared_ptr< DESFireKey > key)=0
 Authenticate a block, given a key number.
 
virtual DESFireCardVersion getVersion ()=0
 Get the card version information.
 
virtual SignatureResult IKS_getLastReadSignature () const
 
- Public Member Functions inherited from logicalaccess::Commands
 Commands ()=delete
 Constructor.
 
virtual ~Commands ()
 
std::shared_ptr< ChipgetChip () const override
 Get the chip.
 
virtual void setChip (std::shared_ptr< Chip > chip)
 Set the chip.
 
std::shared_ptr< ReaderCardAdaptergetReaderCardAdapter () const override
 Get the reader/card adapter.
 
virtual void setReaderCardAdapter (std::shared_ptr< ReaderCardAdapter > adapter)
 Set the reader/card adapter.
 
virtual const std::string & getCmdType () const
 Get the cmd name.
 
virtual void setCmdType (const std::string &command_type)
 Set the cmd name.
 
- Public Member Functions inherited from logicalaccess::ICommands
virtual ~ICommands ()=default
 
virtual std::shared_ptr< ChipgetChip () const =0
 Get the chip.
 
virtual std::shared_ptr< ReaderCardAdaptergetReaderCardAdapter () const =0
 Get the reader/card adapter.
 
- Public Member Functions inherited from logicalaccess::DESFireEV1Commands
 DESFireEV1Commands ()=default
 
virtual void selectApplication (std::shared_ptr< DESFireEV1Location > location)
 Select an application.
 
virtual void createApplication (std::shared_ptr< DESFireEV1Location > location, DESFireKeySettings settings, unsigned char maxNbKeys)
 Create a new application.
 
virtual void createStdDataFile (std::shared_ptr< DESFireEV1Location > location, const DESFireAccessRights &accessRights, unsigned int fileSize)
 Create a new data file in the current application.
 
virtual unsigned int getFreeMem ()=0
 Get the value of available bytes.
 
virtual std::vector< DFNamegetDFNames ()=0
 Get the ISO DF-Names of all active application.
 
virtual std::vector< unsigned short > getISOFileIDs ()=0
 Get the ISO FID of all active files within the currently selected application.
 
virtual void selectApplication (unsigned int aid)=0
 Select an application.
 
virtual void createApplication (unsigned int aid, DESFireKeySettings settings, unsigned char maxNbKeys, DESFireKeyType cryptoMethod, FidSupport fidSupported=FIDS_NO_ISO_FID, unsigned short isoFID=0x00, ByteVector isoDFName=ByteVector())=0
 Create a new application.
 
virtual void getKeySettings (DESFireKeySettings &settings, unsigned char &maxNbKeys, DESFireKeyType &keyType)=0
 Get key settings on the current application.
 
virtual ByteVector getCardUID ()=0
 Get a random card UID.
 
virtual void createStdDataFile (unsigned char fileno, EncryptionMode comSettings, const DESFireAccessRights &accessRights, unsigned int fileSize, unsigned short isoFID=0x00)=0
 Create a new data file in the current application.
 
virtual void createBackupFile (unsigned char fileno, EncryptionMode comSettings, const DESFireAccessRights &accessRights, unsigned int fileSize, unsigned short isoFID=0x00)=0
 Create a new backup file in the current application.
 
virtual void createLinearRecordFile (unsigned char fileno, EncryptionMode comSettings, const DESFireAccessRights &accessRights, unsigned int fileSize, unsigned int maxNumberOfRecords, unsigned short isoFID=0x00)=0
 Create a new linear record file in the current application.
 
virtual void createCyclicRecordFile (unsigned char fileno, EncryptionMode comSettings, const DESFireAccessRights &accessRights, unsigned int fileSize, unsigned int maxNumberOfRecords, unsigned short isoFID=0x00)=0
 Create a new cyclic record file in the current application.
 
virtual void authenticateISO (unsigned char keyno, DESFireISOAlgorithm algorithm=DF_ALG_2K3DES)=0
 AuthenticateISO command.
 
virtual void authenticateAES (unsigned char keyno)=0
 AuthenticateAES command.
 
virtual void setConfiguration (bool formatCardEnabled, bool randomIdEnabled)=0
 Read data from a specific file.
 
virtual void setConfiguration (std::shared_ptr< DESFireKey > defaultKey)=0
 Set the card configuration default key. param defaultKey The new default key.
 
virtual void setConfiguration (const ByteVector &ats)=0
 Set a custom card ATS.
 
virtual std::shared_ptr< ISO7816CommandsgetISO7816Commands () const
 

Protected Member Functions

virtual ISO7816Response handleReadCmd (unsigned char cmd, const ByteVector &data, EncryptionMode mode)
 Generic method to send read file cmd.
 
ByteVector handleReadData (unsigned char err, const ByteVector &firstMsg, unsigned int length, EncryptionMode mode) override
 Generic method to read data from a file.
 
void handleWriteData (unsigned char cmd, const ByteVector &parameters, const ByteVector &data, EncryptionMode mode) override
 Generic method to write data into a file.
 
ISO7816Response transmit (unsigned char cmd, const ByteVector &buf=ByteVector(), unsigned char lc=0, bool forceLc=false) override
 Transmit a command.
 
virtual ISO7816Response transmit_plain (unsigned char cmd, unsigned char lc)
 Transmit a command.
 
virtual ISO7816Response transmit_plain (unsigned char cmd, const ByteVector &buf=ByteVector(), unsigned char lc=0, bool forceLc=false)
 Transmit a command.
 
virtual ISO7816Response transmit_nomacv (unsigned char cmd, unsigned char lc)
 Transmit a command.
 
virtual ISO7816Response transmit_nomacv (unsigned char cmd, const ByteVector &buf=ByteVector(), unsigned char lc=0, bool forceLc=false)
 Transmit a command.
 
void onAuthenticated ()
 
- Protected Member Functions inherited from logicalaccess::DESFireISO7816Commands
ByteVector getKeyInformations (std::shared_ptr< DESFireKey > key, uint8_t keyno) const
 
ByteVector getChangeKeySAMCryptogram (unsigned char keyno, std::shared_ptr< DESFireKey > key) const
 
ByteVector getChangeKeyIKSCryptogram (unsigned char keyno, std::shared_ptr< DESFireKey > key) const
 
virtual ByteVector handleReadData (unsigned char err, const ByteVector &firstMsg, unsigned int length, EncryptionMode mode)
 Generic method to read data from a file.
 
virtual void handleWriteData (unsigned char cmd, const ByteVector &parameters, const ByteVector &data, EncryptionMode mode)
 Generic method to write data into a file.
 
virtual ISO7816Response transmit (unsigned char cmd, unsigned char lc)
 Transmit a command.
 
virtual ISO7816Response transmit (unsigned char cmd, const ByteVector &data=ByteVector(), unsigned char lc=0, bool forceLc=false)
 Transmit a command.
 
bool checkChangeKeySAMKeyStorage (unsigned char keyno, std::shared_ptr< DESFireKey > oldkey, std::shared_ptr< DESFireKey > key)
 
- Protected Member Functions inherited from logicalaccess::DESFireCommands
std::shared_ptr< DESFireChipgetDESFireChip () const
 
- Protected Member Functions inherited from logicalaccess::Commands
 Commands (std::string commandtype)
 Constructor.
 
- Protected Member Functions inherited from logicalaccess::DESFireEV1Commands
std::shared_ptr< DESFireEV1ChipgetDESFireEV1Chip () const
 

Protected Attributes

SignatureResult handle_read_data_last_sig_
 
- Protected Attributes inherited from logicalaccess::DESFireISO7816Commands
std::shared_ptr< SAMChipd_SAM_chip
 The SAMChip used for the SAM Commands.
 
- Protected Attributes inherited from logicalaccess::Commands
std::shared_ptr< ReaderCardAdapterd_readerCardAdapter
 The reader/card adapter.
 
std::weak_ptr< Chipd_chip
 The chip.
 
std::string d_commandtype
 The command type.
 

Detailed Description

The DESFire EV1 base commands class.

Constructor & Destructor Documentation

◆ DESFireEV1ISO7816Commands() [1/2]

logicalaccess::DESFireEV1ISO7816Commands::DESFireEV1ISO7816Commands ( )

Constructor.

◆ DESFireEV1ISO7816Commands() [2/2]

logicalaccess::DESFireEV1ISO7816Commands::DESFireEV1ISO7816Commands ( std::string  ct)
explicit

◆ ~DESFireEV1ISO7816Commands()

logicalaccess::DESFireEV1ISO7816Commands::~DESFireEV1ISO7816Commands ( )
virtual

Destructor.

Member Function Documentation

◆ authenticate()

void logicalaccess::DESFireEV1ISO7816Commands::authenticate ( unsigned char  keyno,
std::shared_ptr< DESFireKey key 
)
overridevirtual

Authenticate, given a key number.

Parameters
keynoThe key number.
keyThe key.

Implements logicalaccess::DESFireCommands.

◆ authenticateAES()

void logicalaccess::DESFireEV1ISO7816Commands::authenticateAES ( unsigned char  keyno)
overridevirtual

AuthenticateAES command.

Parameters
keynoThe key number.

Implements logicalaccess::DESFireEV1Commands.

◆ authenticateISO()

void logicalaccess::DESFireEV1ISO7816Commands::authenticateISO ( unsigned char  keyno,
DESFireISOAlgorithm  algorithm = DF_ALG_2K3DES 
)
overridevirtual

AuthenticateISO command.

Parameters
keynoThe key number.
algorithmThe ISO algorithm to use for authentication.

Implements logicalaccess::DESFireEV1Commands.

◆ changeFileSettings()

void logicalaccess::DESFireEV1ISO7816Commands::changeFileSettings ( unsigned char  fileno,
EncryptionMode  comSettings,
const DESFireAccessRights accessRights,
bool  plain 
)
overridevirtual

Change file settings of a specific file in the current application.

Parameters
filenoThe file number
comSettingsThe file communication setting
accessRightsThe file access rights
plainCommunication is currently in plain data.

Implements logicalaccess::DESFireCommands.

◆ changeKey()

void logicalaccess::DESFireEV1ISO7816Commands::changeKey ( unsigned char  keyno,
std::shared_ptr< DESFireKey key 
)
overridevirtual

Change a key in the current application.

Parameters
keynoThe key number to change
keyThe new key

Implements logicalaccess::DESFireCommands.

◆ changeKeySettings()

void logicalaccess::DESFireEV1ISO7816Commands::changeKeySettings ( DESFireKeySettings  settings)
overridevirtual

Change key settings for the current application.

Parameters
settingsThe new key settings

Implements logicalaccess::DESFireCommands.

◆ createApplication() [1/2]

void logicalaccess::DESFireISO7816Commands::createApplication ( unsigned int  aid,
DESFireKeySettings  settings,
unsigned char  maxNbKeys 
)
overridevirtual

Create a new application.

Parameters
aidThe Application ID to create
settingsKey settings
maxNbKeysMaximum number of keys

Reimplemented from logicalaccess::DESFireISO7816Commands.

◆ createApplication() [2/2]

void logicalaccess::DESFireEV1ISO7816Commands::createApplication ( unsigned int  aid,
DESFireKeySettings  settings,
unsigned char  maxNbKeys,
DESFireKeyType  cryptoMethod,
FidSupport  fidSupported = FIDS_NO_ISO_FID,
unsigned short  isoFID = 0x00,
ByteVector  isoDFName = ByteVector() 
)
overridevirtual

Create a new application.

Parameters
aidThe Application ID to create
settingsKey settings
maxNbKeysMaximum number of keys

Implements logicalaccess::DESFireEV1Commands.

◆ createBackupFile() [1/2]

void logicalaccess::DESFireISO7816Commands::createBackupFile ( unsigned char  fileno,
EncryptionMode  comSettings,
const DESFireAccessRights accessRights,
unsigned int  fileSize 
)
overridevirtual

Create a new backup file in the current application.

Parameters
filenoThe new file number
comSettingsThe file communication setting
accessRightsThe file access rights
fileSizeThe file size.

Reimplemented from logicalaccess::DESFireISO7816Commands.

◆ createBackupFile() [2/2]

void logicalaccess::DESFireEV1ISO7816Commands::createBackupFile ( unsigned char  fileno,
EncryptionMode  comSettings,
const DESFireAccessRights accessRights,
unsigned int  fileSize,
unsigned short  isoFID 
)
overridevirtual

Create a new backup file in the current application.

Parameters
filenoThe new file number
comSettingsThe file communication setting
accessRightsThe file access rights
fileSizeThe file size (in bytes).

Implements logicalaccess::DESFireEV1Commands.

◆ createCyclicRecordFile() [1/2]

void logicalaccess::DESFireISO7816Commands::createCyclicRecordFile ( unsigned char  fileno,
EncryptionMode  comSettings,
const DESFireAccessRights accessRights,
unsigned int  fileSize,
unsigned int  maxNumberOfRecords 
)
overridevirtual

Create a new cyclic record file in the current application.

Parameters
filenoThe new file number
comSettingsThe file communication setting
accessRightsThe file access rights
fileSizeThe file size.
maxNumberOfRecordsMax number of records in the file.

Reimplemented from logicalaccess::DESFireISO7816Commands.

◆ createCyclicRecordFile() [2/2]

void logicalaccess::DESFireEV1ISO7816Commands::createCyclicRecordFile ( unsigned char  fileno,
EncryptionMode  comSettings,
const DESFireAccessRights accessRights,
unsigned int  fileSize,
unsigned int  maxNumberOfRecords,
unsigned short  isoFID 
)
overridevirtual

Create a new cyclic record file in the current application.

Parameters
filenoThe new file number
comSettingsThe file communication setting
accessRightsThe file access rights
fileSizeThe file size (in bytes).
maxNumberOfRecordsMax number of records in the file.

Implements logicalaccess::DESFireEV1Commands.

◆ createLinearRecordFile() [1/2]

void logicalaccess::DESFireISO7816Commands::createLinearRecordFile ( unsigned char  fileno,
EncryptionMode  comSettings,
const DESFireAccessRights accessRights,
unsigned int  fileSize,
unsigned int  maxNumberOfRecords 
)
overridevirtual

Create a new linear record file in the current application.

Parameters
filenoThe new file number
comSettingsThe file communication setting
accessRightsThe file access rights
fileSizeThe file size.
maxNumberOfRecordsMax number of records in the file.

Reimplemented from logicalaccess::DESFireISO7816Commands.

◆ createLinearRecordFile() [2/2]

void logicalaccess::DESFireEV1ISO7816Commands::createLinearRecordFile ( unsigned char  fileno,
EncryptionMode  comSettings,
const DESFireAccessRights accessRights,
unsigned int  fileSize,
unsigned int  maxNumberOfRecords,
unsigned short  isoFID 
)
overridevirtual

Create a new linear record file in the current application.

Parameters
filenoThe new file number
comSettingsThe file communication setting
accessRightsThe file access rights
fileSizeThe file size (in bytes).
maxNumberOfRecordsMax number of records in the file.

Implements logicalaccess::DESFireEV1Commands.

◆ createStdDataFile() [1/2]

void logicalaccess::DESFireISO7816Commands::createStdDataFile ( unsigned char  fileno,
EncryptionMode  comSettings,
const DESFireAccessRights accessRights,
unsigned int  fileSize 
)
overridevirtual

Create a new data file in the current application.

Parameters
filenoThe new file number
comSettingsThe file communication setting
accessRightsThe file access rights
fileSizeThe file size.

Reimplemented from logicalaccess::DESFireISO7816Commands.

◆ createStdDataFile() [2/2]

void logicalaccess::DESFireEV1ISO7816Commands::createStdDataFile ( unsigned char  fileno,
EncryptionMode  comSettings,
const DESFireAccessRights accessRights,
unsigned int  fileSize,
unsigned short  isoFID 
)
overridevirtual

Create a new data file in the current application.

Parameters
filenoThe new file number
comSettingsThe file communication setting
accessRightsThe file access rights
fileSizeThe file size (in bytes).

Implements logicalaccess::DESFireEV1Commands.

◆ extract_iks_div_info()

MyDivInfo logicalaccess::DESFireEV1ISO7816Commands::extract_iks_div_info ( std::shared_ptr< Key key,
uint8_t  keyno 
)

◆ getApplicationIDs()

std::vector< unsigned int > logicalaccess::DESFireEV1ISO7816Commands::getApplicationIDs ( )
overridevirtual

Get the current application list.

Returns
The application list.

Implements logicalaccess::DESFireCommands.

◆ getCardUID()

ByteVector logicalaccess::DESFireEV1ISO7816Commands::getCardUID ( )
overridevirtual

Get a random card UID.

Returns
The card UID.

Implements logicalaccess::DESFireEV1Commands.

◆ getChip()

std::shared_ptr< Chip > logicalaccess::DESFireEV1ISO7816Commands::getChip ( ) const
inlineoverridevirtual

Get the chip.

Returns
The chip.

Implements logicalaccess::ICommands.

◆ getDFNames()

std::vector< DFName > logicalaccess::DESFireEV1ISO7816Commands::getDFNames ( )
overridevirtual

Get the ISO DF-Names of all active application.

Returns
The DF-Names list.

Implements logicalaccess::DESFireEV1Commands.

◆ getFileIDs()

ByteVector logicalaccess::DESFireEV1ISO7816Commands::getFileIDs ( )
overridevirtual

Get the File IDentifiers of all active files within the currently selected application.

Returns
The file ID list.

Implements logicalaccess::DESFireCommands.

◆ getFreeMem()

unsigned int logicalaccess::DESFireEV1ISO7816Commands::getFreeMem ( )
overridevirtual

Get the value of available bytes.

Returns
The available memory in bytes.

Implements logicalaccess::DESFireEV1Commands.

◆ getISO7816Commands()

std::shared_ptr< ISO7816Commands > logicalaccess::DESFireEV1ISO7816Commands::getISO7816Commands ( ) const
inlineoverridevirtual

Reimplemented from logicalaccess::DESFireEV1Commands.

◆ getISOFileIDs()

std::vector< unsigned short > logicalaccess::DESFireEV1ISO7816Commands::getISOFileIDs ( )
overridevirtual

Get the ISO FID of all active files within the currently selected application.

Returns
The ISO FID list.

Implements logicalaccess::DESFireEV1Commands.

◆ getKeySettings() [1/2]

void logicalaccess::DESFireISO7816Commands::getKeySettings ( DESFireKeySettings settings,
unsigned char &  maxNbKeys 
)
overridevirtual

Get key settings on the current application.

Parameters
settingsKey settings
maxNbKeysMaximum number of keys

Reimplemented from logicalaccess::DESFireISO7816Commands.

◆ getKeySettings() [2/2]

void logicalaccess::DESFireEV1ISO7816Commands::getKeySettings ( DESFireKeySettings settings,
unsigned char &  maxNbKeys,
DESFireKeyType keyType 
)
overridevirtual

Get key settings on the current application.

Parameters
settingsKey settings
maxNbKeysMaximum number of keys
keyTypeThe key type

Implements logicalaccess::DESFireEV1Commands.

◆ getReaderCardAdapter()

std::shared_ptr< ReaderCardAdapter > logicalaccess::DESFireEV1ISO7816Commands::getReaderCardAdapter ( ) const
inlineoverridevirtual

Get the reader/card adapter.

Returns
The reader/card adapter.

Implements logicalaccess::ICommands.

◆ getValue()

int32_t logicalaccess::DESFireEV1ISO7816Commands::getValue ( unsigned char  fileno,
EncryptionMode  mode 
)
overridevirtual

Get value from a specific value file.

Parameters
filenoThe file number
modeThe communication mode
valueThe value stored in the card

Implements logicalaccess::DESFireCommands.

◆ getVersion()

DESFireCommands::DESFireCardVersion logicalaccess::DESFireEV1ISO7816Commands::getVersion ( )
overridevirtual

Get the card version information.

Parameters
dataVersionThe card version information structure that will be filled

Implements logicalaccess::DESFireCommands.

◆ handleReadCmd()

ISO7816Response logicalaccess::DESFireEV1ISO7816Commands::handleReadCmd ( unsigned char  cmd,
const ByteVector data,
EncryptionMode  mode 
)
protectedvirtual

Generic method to send read file cmd.

Parameters
cmdThe command to send
dataThe command parameters
modeThe communication mode
Returns
The data buffer.

◆ handleReadData()

ByteVector logicalaccess::DESFireEV1ISO7816Commands::handleReadData ( unsigned char  err,
const ByteVector firstMsg,
unsigned int  length,
EncryptionMode  mode 
)
overrideprotectedvirtual

Generic method to read data from a file.

Parameters
errThe last error code
firstMsgThe first message to send
lengthThe length to read
modeThe communication mode
Returns
The data buffer.

Reimplemented from logicalaccess::DESFireISO7816Commands.

◆ handleWriteData()

void logicalaccess::DESFireEV1ISO7816Commands::handleWriteData ( unsigned char  cmd,
const ByteVector parameters,
const ByteVector data,
EncryptionMode  mode 
)
overrideprotectedvirtual

Generic method to write data into a file.

Parameters
cmdThe command to send
parametersThe command parameters
dataThe data buffer
modeThe communication mode

Reimplemented from logicalaccess::DESFireISO7816Commands.

◆ iks_authenticateAES()

void logicalaccess::DESFireEV1ISO7816Commands::iks_authenticateAES ( std::shared_ptr< DESFireKey key,
uint8_t  keyno 
)

◆ IKS_getLastReadSignature()

SignatureResult logicalaccess::DESFireEV1ISO7816Commands::IKS_getLastReadSignature ( ) const
overridevirtual

Retrieve the IKS signature corresponding the last PARTIAL read. todo: Should retrieve something for the whole readData() block.

But currently this work using the underlying DESFireCrypto and therefore signature can only be retrieve for by block passed to handleReadData().

Reimplemented from logicalaccess::DESFireCommands.

◆ iks_iso_authenticate()

void logicalaccess::DESFireEV1ISO7816Commands::iks_iso_authenticate ( std::shared_ptr< DESFireKey key,
bool  isMasterCardKey,
uint8_t  keyno 
)
virtual

Perform the authentication relying on Islog Key Server to perform cryptographic operation. This routine is suitable only for AES key: this is enforced by assertion.

◆ iso_authenticate()

void logicalaccess::DESFireEV1ISO7816Commands::iso_authenticate ( std::shared_ptr< DESFireKey key,
DESFireISOAlgorithm  algorithm = DF_ALG_2K3DES,
bool  isMasterCardKey = true,
unsigned char  keyno = 0x00 
)
virtual

ISO authenticate.

Parameters
keyThe key.
algorithmThe ISO algorithm to use for authentication.
isMasterCardKeyTrue if the key to authenticate is the master card key, false otherwise.
keynoThe key number.

◆ onAuthenticated()

void logicalaccess::DESFireEV1ISO7816Commands::onAuthenticated ( )
protected

Called after authentication was performed

◆ pkcs_iso_authenticate()

void logicalaccess::DESFireEV1ISO7816Commands::pkcs_iso_authenticate ( std::shared_ptr< DESFireKey key,
bool  isMasterCardKey = true,
unsigned char  keyno = 0x00 
)

◆ readData()

ByteVector logicalaccess::DESFireEV1ISO7816Commands::readData ( unsigned char  fileno,
unsigned int  offset,
unsigned int  length,
EncryptionMode  mode 
)
overridevirtual

Read data from a specific file.

Parameters
filenoThe file number
offsetThe byte offset
lengthThe data length to read
modeThe communication mode
Returns
The bytes readed.

Implements logicalaccess::DESFireCommands.

◆ readRecords()

ByteVector logicalaccess::DESFireEV1ISO7816Commands::readRecords ( unsigned char  fileno,
unsigned int  offset,
unsigned int  length,
EncryptionMode  mode 
)
overridevirtual

Read record from a specific record file.

Parameters
filenoThe file number
offsetThe byte offset
lengthThe length to read
dataThe data buffer
modeThe communication mode
Returns
The number of bytes read.

Implements logicalaccess::DESFireCommands.

◆ sam_iso_authenticate()

void logicalaccess::DESFireEV1ISO7816Commands::sam_iso_authenticate ( std::shared_ptr< DESFireKey key,
DESFireISOAlgorithm  algorithm,
bool  isMasterCardKey,
unsigned char  keyno 
)
virtual

◆ selectApplication()

void logicalaccess::DESFireEV1ISO7816Commands::selectApplication ( unsigned int  aid)
overridevirtual

Select an application.

Parameters
aidThe Application ID

Implements logicalaccess::DESFireEV1Commands.

◆ setConfiguration() [1/3]

void logicalaccess::DESFireEV1ISO7816Commands::setConfiguration ( bool  formatCardEnabled,
bool  randomIdEnabled 
)
overridevirtual

Set the card configuration.

Parameters
formatCardEnabledIf true, the format card command is enabled.
randomIdEnabledIf true, the CSN is random.

Implements logicalaccess::DESFireEV1Commands.

◆ setConfiguration() [2/3]

void logicalaccess::DESFireEV1ISO7816Commands::setConfiguration ( const ByteVector ats)
overridevirtual

Set a custom card ATS.

Parameters
atsThe new card ATS.

Implements logicalaccess::DESFireEV1Commands.

◆ setConfiguration() [3/3]

void logicalaccess::DESFireEV1ISO7816Commands::setConfiguration ( std::shared_ptr< DESFireKey defaultKey)
overridevirtual

Set the card configuration default key. param defaultKey The new default key.

Implements logicalaccess::DESFireEV1Commands.

◆ transmit()

ISO7816Response logicalaccess::DESFireEV1ISO7816Commands::transmit ( unsigned char  cmd,
const ByteVector buf = ByteVector(),
unsigned char  lc = 0,
bool  forceLc = false 
)
overrideprotectedvirtual

Transmit a command.

Parameters
cmdThe command code.
bufThe command buffer.
buflenThe command buffer length.
forceLcUndocumented.
Returns
The response.

Reimplemented from logicalaccess::DESFireISO7816Commands.

◆ transmit_nomacv() [1/2]

ISO7816Response logicalaccess::DESFireEV1ISO7816Commands::transmit_nomacv ( unsigned char  cmd,
const ByteVector buf = ByteVector(),
unsigned char  lc = 0,
bool  forceLc = false 
)
protectedvirtual

Transmit a command.

Parameters
cmdThe command code.
bufThe command buffer.
buflenThe command buffer length.
forceLcUndocumented.
Returns
The response.

◆ transmit_nomacv() [2/2]

ISO7816Response logicalaccess::DESFireEV1ISO7816Commands::transmit_nomacv ( unsigned char  cmd,
unsigned char  lc 
)
protectedvirtual

Transmit a command.

Parameters
cmdThe command code.
lcUndocumented.
Returns
The response.

◆ transmit_plain() [1/2]

ISO7816Response logicalaccess::DESFireEV1ISO7816Commands::transmit_plain ( unsigned char  cmd,
const ByteVector buf = ByteVector(),
unsigned char  lc = 0,
bool  forceLc = false 
)
protectedvirtual

Transmit a command.

Parameters
cmdThe command code.
bufThe command buffer.
buflenThe command buffer length.
forceLcUndocumented.
Returns
The response.

◆ transmit_plain() [2/2]

ISO7816Response logicalaccess::DESFireEV1ISO7816Commands::transmit_plain ( unsigned char  cmd,
unsigned char  lc 
)
protectedvirtual

Transmit a command.

Parameters
cmdThe command code.
lcUndocumented.
Returns
The response.

Member Data Documentation

◆ handle_read_data_last_sig_

SignatureResult logicalaccess::DESFireEV1ISO7816Commands::handle_read_data_last_sig_
protected

The documentation for this class was generated from the following files: