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

The DESFire EV1 base commands class. More...

#include <desfireev1commands.hpp>

Inheritance diagram for logicalaccess::DESFireEV1Commands:
logicalaccess::ICommands logicalaccess::DESFireEV1ISO7816Commands logicalaccess::DESFireEV1STidSTRCommands

Public Member Functions

 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
 
- 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.
 

Protected Member Functions

std::shared_ptr< DESFireEV1ChipgetDESFireEV1Chip () const
 

Detailed Description

The DESFire EV1 base commands class.

Constructor & Destructor Documentation

◆ DESFireEV1Commands()

logicalaccess::DESFireEV1Commands::DESFireEV1Commands ( )
default

Member Function Documentation

◆ authenticateAES()

virtual void logicalaccess::DESFireEV1Commands::authenticateAES ( unsigned char  keyno)
pure virtual

AuthenticateAES command.

Parameters
keynoThe key number.

Implemented in logicalaccess::DESFireEV1ISO7816Commands, and logicalaccess::DESFireEV1STidSTRCommands.

◆ authenticateISO()

virtual void logicalaccess::DESFireEV1Commands::authenticateISO ( unsigned char  keyno,
DESFireISOAlgorithm  algorithm = DF_ALG_2K3DES 
)
pure virtual

AuthenticateISO command.

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

Implemented in logicalaccess::DESFireEV1ISO7816Commands, and logicalaccess::DESFireEV1STidSTRCommands.

◆ createApplication() [1/2]

void logicalaccess::DESFireEV1Commands::createApplication ( std::shared_ptr< DESFireEV1Location location,
DESFireKeySettings  settings,
unsigned char  maxNbKeys 
)
virtual

Create a new application.

Parameters
locationThe DESFire location
settingsKey settings
maxNbKeysMaximum number of keys

Reimplemented in logicalaccess::DESFireEV1STidSTRCommands.

◆ createApplication() [2/2]

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

Create a new application.

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

Implemented in logicalaccess::DESFireEV1ISO7816Commands, logicalaccess::DESFireEV1STidSTRCommands, and logicalaccess::DESFireEV1STidSTRCommands.

◆ createBackupFile()

virtual void logicalaccess::DESFireEV1Commands::createBackupFile ( unsigned char  fileno,
EncryptionMode  comSettings,
const DESFireAccessRights accessRights,
unsigned int  fileSize,
unsigned short  isoFID = 0x00 
)
pure virtual

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).

Implemented in logicalaccess::DESFireEV1ISO7816Commands, and logicalaccess::DESFireEV1STidSTRCommands.

◆ createCyclicRecordFile()

virtual void logicalaccess::DESFireEV1Commands::createCyclicRecordFile ( unsigned char  fileno,
EncryptionMode  comSettings,
const DESFireAccessRights accessRights,
unsigned int  fileSize,
unsigned int  maxNumberOfRecords,
unsigned short  isoFID = 0x00 
)
pure virtual

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.

Implemented in logicalaccess::DESFireEV1ISO7816Commands, and logicalaccess::DESFireEV1STidSTRCommands.

◆ createLinearRecordFile()

virtual void logicalaccess::DESFireEV1Commands::createLinearRecordFile ( unsigned char  fileno,
EncryptionMode  comSettings,
const DESFireAccessRights accessRights,
unsigned int  fileSize,
unsigned int  maxNumberOfRecords,
unsigned short  isoFID = 0x00 
)
pure virtual

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.

Implemented in logicalaccess::DESFireEV1ISO7816Commands, and logicalaccess::DESFireEV1STidSTRCommands.

◆ createStdDataFile() [1/2]

void logicalaccess::DESFireEV1Commands::createStdDataFile ( std::shared_ptr< DESFireEV1Location location,
const DESFireAccessRights accessRights,
unsigned int  fileSize 
)
virtual

Create a new data file in the current application.

Parameters
locationThe DESFire location
accessRightsThe file access rights
fileSizeThe file size.

Reimplemented in logicalaccess::DESFireEV1STidSTRCommands.

◆ createStdDataFile() [2/2]

virtual void logicalaccess::DESFireEV1Commands::createStdDataFile ( unsigned char  fileno,
EncryptionMode  comSettings,
const DESFireAccessRights accessRights,
unsigned int  fileSize,
unsigned short  isoFID = 0x00 
)
pure virtual

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).

Implemented in logicalaccess::DESFireEV1ISO7816Commands, logicalaccess::DESFireEV1STidSTRCommands, and logicalaccess::DESFireEV1STidSTRCommands.

◆ getCardUID()

virtual ByteVector logicalaccess::DESFireEV1Commands::getCardUID ( )
pure virtual

Get a random card UID.

Returns
The card UID.

Implemented in logicalaccess::DESFireEV1ISO7816Commands, and logicalaccess::DESFireEV1STidSTRCommands.

◆ getDESFireEV1Chip()

std::shared_ptr< DESFireEV1Chip > logicalaccess::DESFireEV1Commands::getDESFireEV1Chip ( ) const
protected

◆ getDFNames()

virtual std::vector< DFName > logicalaccess::DESFireEV1Commands::getDFNames ( )
pure virtual

Get the ISO DF-Names of all active application.

Returns
The DF-Names list.

Implemented in logicalaccess::DESFireEV1ISO7816Commands, and logicalaccess::DESFireEV1STidSTRCommands.

◆ getFreeMem()

virtual unsigned int logicalaccess::DESFireEV1Commands::getFreeMem ( )
pure virtual

Get the value of available bytes.

Returns
The available memory in bytes.

Implemented in logicalaccess::DESFireEV1ISO7816Commands, and logicalaccess::DESFireEV1STidSTRCommands.

◆ getISO7816Commands()

virtual std::shared_ptr< ISO7816Commands > logicalaccess::DESFireEV1Commands::getISO7816Commands ( ) const
inlinevirtual

◆ getISOFileIDs()

virtual std::vector< unsigned short > logicalaccess::DESFireEV1Commands::getISOFileIDs ( )
pure virtual

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

Returns
The ISO FID list.

Implemented in logicalaccess::DESFireEV1ISO7816Commands, and logicalaccess::DESFireEV1STidSTRCommands.

◆ getKeySettings()

virtual void logicalaccess::DESFireEV1Commands::getKeySettings ( DESFireKeySettings settings,
unsigned char &  maxNbKeys,
DESFireKeyType keyType 
)
pure virtual

Get key settings on the current application.

Parameters
settingsKey settings
maxNbKeysMaximum number of keys
keyTypeThe key type

Implemented in logicalaccess::DESFireEV1ISO7816Commands, and logicalaccess::DESFireEV1STidSTRCommands.

◆ selectApplication() [1/2]

void logicalaccess::DESFireEV1Commands::selectApplication ( std::shared_ptr< DESFireEV1Location location)
virtual

Select an application.

Parameters
locationThe DESFire location

◆ selectApplication() [2/2]

virtual void logicalaccess::DESFireEV1Commands::selectApplication ( unsigned int  aid)
pure virtual

Select an application.

Parameters
aidThe Application ID

Implemented in logicalaccess::DESFireEV1ISO7816Commands, and logicalaccess::DESFireEV1STidSTRCommands.

◆ setConfiguration() [1/3]

virtual void logicalaccess::DESFireEV1Commands::setConfiguration ( bool  formatCardEnabled,
bool  randomIdEnabled 
)
pure virtual

Read data from a specific file.

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

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.

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.
Returns
True on success, false otherwise.

Change key settings for the current application.

Parameters
settingsThe new key settings
Returns
True on success, false otherwise.

Change a key in the current application.

Parameters
keynoThe key number to change
keyThe new key
Returns
True on success, false otherwise.

Get the card version information.

Parameters
dataVersionThe card version information structure that will be filled
Returns
True on success, false otherwise.

Get the current application list.

Returns
The application list.

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

Returns
The file ID list.

Get value from a specific value file.

Parameters
filenoThe file number
modeThe communication mode
valueThe value stored in the card
Returns
True on success, false otherwise.

Set the card configuration.

Parameters
formatCardEnabledIf true, the format card command is enabled.
randomIdEnabledIf true, the CSN is random (can't be changed once activated).

Implemented in logicalaccess::DESFireEV1ISO7816Commands, and logicalaccess::DESFireEV1STidSTRCommands.

◆ setConfiguration() [2/3]

virtual void logicalaccess::DESFireEV1Commands::setConfiguration ( const ByteVector ats)
pure virtual

Set a custom card ATS.

Parameters
atsThe new card ATS.

Implemented in logicalaccess::DESFireEV1ISO7816Commands, and logicalaccess::DESFireEV1STidSTRCommands.

◆ setConfiguration() [3/3]

virtual void logicalaccess::DESFireEV1Commands::setConfiguration ( std::shared_ptr< DESFireKey defaultKey)
pure virtual

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

Implemented in logicalaccess::DESFireEV1ISO7816Commands, and logicalaccess::DESFireEV1STidSTRCommands.


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