LibLogicalAccess
2.5.0
An Open Source RFID Library
|
The DESFire commands class. More...
#include <desfirecommands.hpp>
Classes | |
struct | DataFileSetting |
Describe setting for Data File type. More... | |
struct | DESFireCardVersion |
Card information about software and hardware version. More... | |
struct | FileSetting |
Describe file setting. More... | |
struct | RecordFileSetting |
Describe setting for Record File type. More... | |
struct | ValueFileSetting |
Describe setting for Value File type. More... | |
Public Member Functions | |
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 |
![]() | |
Commands ()=delete | |
Constructor. | |
virtual | ~Commands () |
std::shared_ptr< Chip > | getChip () const override |
Get the chip. | |
virtual void | setChip (std::shared_ptr< Chip > chip) |
Set the chip. | |
std::shared_ptr< ReaderCardAdapter > | getReaderCardAdapter () 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. | |
![]() | |
virtual | ~ICommands ()=default |
virtual std::shared_ptr< Chip > | getChip () const =0 |
Get the chip. | |
virtual std::shared_ptr< ReaderCardAdapter > | getReaderCardAdapter () const =0 |
Get the reader/card adapter. | |
Protected Member Functions | |
std::shared_ptr< DESFireChip > | getDESFireChip () const |
![]() | |
Commands (std::string commandtype) | |
Constructor. | |
Additional Inherited Members | |
![]() | |
std::shared_ptr< ReaderCardAdapter > | d_readerCardAdapter |
The reader/card adapter. | |
std::weak_ptr< Chip > | d_chip |
The chip. | |
std::string | d_commandtype |
The command type. | |
The DESFire commands class.
|
inline |
Constructor.
|
inlineexplicit |
Constructor.
ct | The cmd type. |
|
virtual |
|
pure virtual |
Abort the transaction.
Implemented in logicalaccess::DESFireISO7816Commands.
|
pure virtual |
Authenticate a block, given a key number.
keyno | The key number. |
key | The key. |
Implemented in logicalaccess::DESFireEV1ISO7816Commands, and logicalaccess::DESFireISO7816Commands.
|
pure virtual |
Authenticate a block, given a key number.
keyno | The key number, previously loaded on the profile. |
Implemented in logicalaccess::DESFireISO7816Commands.
|
pure virtual |
Change file settings of a specific file in the current application.
fileno | The file number |
comSettings | The file communication setting |
accessRights | The file access rights |
plain | Communication is currently in plain data. |
Implemented in logicalaccess::DESFireEV1ISO7816Commands, and logicalaccess::DESFireISO7816Commands.
|
pure virtual |
Change a key in the current application.
keyno | The key number to change |
key | The new key |
Implemented in logicalaccess::DESFireEV1ISO7816Commands, and logicalaccess::DESFireISO7816Commands.
|
pure virtual |
Change key settings for the current application.
settings | The new key settings |
Implemented in logicalaccess::DESFireEV1ISO7816Commands, and logicalaccess::DESFireISO7816Commands.
|
pure virtual |
Clear a specific record file.
fileno | The file number. |
Implemented in logicalaccess::DESFireISO7816Commands.
|
pure virtual |
Commit the transaction.
Implemented in logicalaccess::DESFireISO7816Commands.
|
virtual |
Create a new application.
location | The DESFire location |
settings | Key settings |
maxNbKeys | Maximum number of keys |
|
pure virtual |
Create a new application.
aid | The Application ID to create |
settings | Key settings |
maxNbKeys | Maximum number of keys |
Implemented in logicalaccess::DESFireEV1ISO7816Commands, and logicalaccess::DESFireISO7816Commands.
|
pure virtual |
Create a new backup file in the current application.
fileno | The new file number |
comSettings | The file communication setting |
accessRights | The file access rights |
fileSize | The file size. |
Implemented in logicalaccess::DESFireEV1ISO7816Commands, and logicalaccess::DESFireISO7816Commands.
|
pure virtual |
Create a new cyclic record file in the current application.
fileno | The new file number |
comSettings | The file communication setting |
accessRights | The file access rights |
fileSize | The file size. |
maxNumberOfRecords | Max number of records in the file. |
Implemented in logicalaccess::DESFireEV1ISO7816Commands, and logicalaccess::DESFireISO7816Commands.
|
pure virtual |
Create a new linear record file in the current application.
fileno | The new file number |
comSettings | The file communication setting |
accessRights | The file access rights |
fileSize | The file size. |
maxNumberOfRecords | Max number of records in the file. |
Implemented in logicalaccess::DESFireEV1ISO7816Commands, and logicalaccess::DESFireISO7816Commands.
|
virtual |
Create a new data file in the current application.
location | The DESFire location |
accessRights | The file access rights |
fileSize | The file size. |
|
pure virtual |
Create a new data file in the current application.
fileno | The new file number |
comSettings | The file communication setting |
accessRights | The file access rights |
fileSize | The file size. |
Implemented in logicalaccess::DESFireEV1ISO7816Commands, and logicalaccess::DESFireISO7816Commands.
|
pure virtual |
Create a new value file in the current application.
fileno | The new file number |
comSettings | The file communication setting |
accessRights | The file access rights |
lowerLimit | The file size (in bytes) |
upperLimit | The file size (in bytes) |
value | The default value |
limitedCreditEnabled | Set if the limited credit is enabled |
Implemented in logicalaccess::DESFireISO7816Commands.
|
pure virtual |
Credit a specific value file.
fileno | The file number |
value | The value to credit |
mode | The communication mode |
Implemented in logicalaccess::DESFireISO7816Commands.
|
pure virtual |
Debit a specific value file.
fileno | The file number |
value | The value to debit |
mode | The communication mode |
Implemented in logicalaccess::DESFireISO7816Commands.
|
pure virtual |
Delete an application.
aid | The Application ID to delete |
Implemented in logicalaccess::DESFireISO7816Commands.
|
pure virtual |
Delete a file in the current application.
fileno | The file number to delete |
Implemented in logicalaccess::DESFireISO7816Commands.
|
pure virtual |
Erase the card.
Implemented in logicalaccess::DESFireISO7816Commands.
|
pure virtual |
Get the current application list.
Implemented in logicalaccess::DESFireEV1ISO7816Commands, and logicalaccess::DESFireISO7816Commands.
|
protected |
|
virtual |
|
virtual |
Get the communication mode for a file.
fileno | The file number |
isReadMode | Is read or write mode |
needLoadKey | Set if it's necessary to be authenticate for the access. |
|
pure virtual |
Get the File IDentifiers of all active files within the currently selected application.
Implemented in logicalaccess::DESFireEV1ISO7816Commands, and logicalaccess::DESFireISO7816Commands.
|
virtual |
Get the length of a file.
fileno | The file number |
|
pure virtual |
Get settings of a specific file in the current application.
fileno | The file number |
fileSetting | The file setting |
Implemented in logicalaccess::DESFireISO7816Commands.
|
pure virtual |
Get key settings on the current application.
settings | Key settings |
maxNbKeys | Maximum number of keys |
Implemented in logicalaccess::DESFireEV1ISO7816Commands, and logicalaccess::DESFireISO7816Commands.
|
pure virtual |
Get value from a specific value file.
fileno | The file number |
mode | The communicatio mode |
value | The value stored in the card |
Implemented in logicalaccess::DESFireEV1ISO7816Commands, and logicalaccess::DESFireISO7816Commands.
|
pure virtual |
Get the card version information.
dataVersion | The card version information structure that will be filled |
Implemented in logicalaccess::DESFireEV1ISO7816Commands, and logicalaccess::DESFireISO7816Commands.
|
inlinevirtual |
Get the IKS signature corresponding to the last readData() call.
This will return the empty SignatureResult and will only work if both: 1) DESFireEV1ISO7816 is used. 2) An IKS backend is used.
Reimplemented in logicalaccess::DESFireEV1ISO7816Commands.
|
pure virtual |
Limit credit on a specific value file.
fileno | The file number |
value | The value to limit credit |
mode | The communication mode |
Implemented in logicalaccess::DESFireISO7816Commands.
|
pure virtual |
Read data from a specific file.
fileno | The file number |
offset | The byte offset |
length | The data length to read |
mode | The communication mode |
Implemented in logicalaccess::DESFireEV1ISO7816Commands, and logicalaccess::DESFireISO7816Commands.
|
pure virtual |
Read record from a specific record file.
fileno | The file number |
offset | The byte offset |
length | The length to read |
mode | The communication mode |
Implemented in logicalaccess::DESFireEV1ISO7816Commands, and logicalaccess::DESFireISO7816Commands.
|
virtual |
Select an application.
location | The DESFire location |
|
pure virtual |
Select an application.
aid | The Application ID |
Implemented in logicalaccess::DESFireEV1ISO7816Commands, and logicalaccess::DESFireISO7816Commands.
|
pure virtual |
Write data into a specific file.
fileno | The file number |
offset | The byte offset |
data | The data buffer |
mode | The communication mode |
Implemented in logicalaccess::DESFireISO7816Commands.
|
pure virtual |
Write record into a specific record file.
fileno | The file number |
offset | The byte offset |
data | The data buffer |
mode | The communication mode |
Implemented in logicalaccess::DESFireISO7816Commands.