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::DESFireISO7816Commands Class Reference

The DESFire base commands class. More...

#include <desfireiso7816commands.hpp>

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

Public Member Functions

 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.
 

Protected Member Functions

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 Attributes

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 base commands class.

Constructor & Destructor Documentation

◆ DESFireISO7816Commands() [1/2]

logicalaccess::DESFireISO7816Commands::DESFireISO7816Commands ( )

Constructor.

◆ DESFireISO7816Commands() [2/2]

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

◆ ~DESFireISO7816Commands()

logicalaccess::DESFireISO7816Commands::~DESFireISO7816Commands ( )
virtual

Destructor.

Member Function Documentation

◆ abortTransaction()

void logicalaccess::DESFireISO7816Commands::abortTransaction ( )
overridevirtual

Abort the transaction.

Implements logicalaccess::DESFireCommands.

◆ authenticate() [1/2]

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

Authenticate, given a key number.

Parameters
keynoThe key number.
keyThe key.

Implements logicalaccess::DESFireCommands.

◆ authenticate() [2/2]

void logicalaccess::DESFireISO7816Commands::authenticate ( unsigned char  keyno = 0)
overridevirtual

Authenticate, given a key number.

Parameters
keynoThe key number, previously loaded on the profile.

Implements logicalaccess::DESFireCommands.

◆ changeFileSettings()

void logicalaccess::DESFireISO7816Commands::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::DESFireISO7816Commands::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::DESFireISO7816Commands::changeKeySettings ( DESFireKeySettings  settings)
overridevirtual

Change key settings for the current application.

Parameters
settingsThe new key settings

Implements logicalaccess::DESFireCommands.

◆ checkChangeKeySAMKeyStorage()

bool logicalaccess::DESFireISO7816Commands::checkChangeKeySAMKeyStorage ( unsigned char  keyno,
std::shared_ptr< DESFireKey oldkey,
std::shared_ptr< DESFireKey key 
)
protected

◆ clearRecordFile()

void logicalaccess::DESFireISO7816Commands::clearRecordFile ( unsigned char  fileno)
overridevirtual

Clear a specific record file.

Parameters
filenoThe file number.

Implements logicalaccess::DESFireCommands.

◆ commitTransaction()

void logicalaccess::DESFireISO7816Commands::commitTransaction ( )
overridevirtual

Commit the transaction.

Implements logicalaccess::DESFireCommands.

◆ createApplication()

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

Implements logicalaccess::DESFireCommands.

Reimplemented in logicalaccess::DESFireEV1ISO7816Commands.

◆ createBackupFile()

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.

Implements logicalaccess::DESFireCommands.

Reimplemented in logicalaccess::DESFireEV1ISO7816Commands.

◆ createCyclicRecordFile()

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.

Implements logicalaccess::DESFireCommands.

Reimplemented in logicalaccess::DESFireEV1ISO7816Commands.

◆ createLinearRecordFile()

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.

Implements logicalaccess::DESFireCommands.

Reimplemented in logicalaccess::DESFireEV1ISO7816Commands.

◆ createStdDataFile()

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.

Implements logicalaccess::DESFireCommands.

Reimplemented in logicalaccess::DESFireEV1ISO7816Commands.

◆ createValueFile()

void logicalaccess::DESFireISO7816Commands::createValueFile ( unsigned char  fileno,
EncryptionMode  comSettings,
const DESFireAccessRights accessRights,
int32_t  lowerLimit,
int32_t  upperLimit,
int32_t  value,
bool  limitedCreditEnabled 
)
overridevirtual

Create a new value file in the current application.

Parameters
filenoThe new file number
comSettingsThe file communication setting
accessRightsThe file access rights
lowerLimitThe file size (in bytes)
upperLimitThe file size (in bytes)
valueThe default value
limitedCreditEnabledSet if the limited credit is enabled

Implements logicalaccess::DESFireCommands.

◆ credit()

void logicalaccess::DESFireISO7816Commands::credit ( unsigned char  fileno,
unsigned int  value,
EncryptionMode  mode 
)
overridevirtual

Credit a specific value file.

Parameters
filenoThe file number
valueThe value to credit
modeThe communication mode

Implements logicalaccess::DESFireCommands.

◆ debit()

void logicalaccess::DESFireISO7816Commands::debit ( unsigned char  fileno,
unsigned int  value,
EncryptionMode  mode 
)
overridevirtual

Debit a specific value file.

Parameters
filenoThe file number
valueThe value to debit
modeThe communication mode

Implements logicalaccess::DESFireCommands.

◆ deleteApplication()

void logicalaccess::DESFireISO7816Commands::deleteApplication ( unsigned int  aid)
overridevirtual

Delete an application.

Parameters
aidThe Application ID to delete

Implements logicalaccess::DESFireCommands.

◆ deleteFile()

void logicalaccess::DESFireISO7816Commands::deleteFile ( unsigned char  fileno)
overridevirtual

Delete a file in the current application.

Parameters
filenoThe file number to delete

Implements logicalaccess::DESFireCommands.

◆ erase()

void logicalaccess::DESFireISO7816Commands::erase ( )
overridevirtual

Erase the card.

Implements logicalaccess::DESFireCommands.

◆ getApplicationIDs()

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

Get the current application list.

Returns
The current application list.

Implements logicalaccess::DESFireCommands.

◆ getChangeKeyIKSCryptogram()

ByteVector logicalaccess::DESFireISO7816Commands::getChangeKeyIKSCryptogram ( unsigned char  keyno,
std::shared_ptr< DESFireKey key 
) const
protected

◆ getChangeKeySAMCryptogram()

ByteVector logicalaccess::DESFireISO7816Commands::getChangeKeySAMCryptogram ( unsigned char  keyno,
std::shared_ptr< DESFireKey key 
) const
protected

◆ getFileIDs()

ByteVector logicalaccess::DESFireISO7816Commands::getFileIDs ( )
overridevirtual

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

Returns
The file IDs.

Implements logicalaccess::DESFireCommands.

◆ getFileSettings()

DESFireCommands::FileSetting logicalaccess::DESFireISO7816Commands::getFileSettings ( unsigned char  fileno)
overridevirtual

Get settings of a specific file in the current application.

Parameters
filenoThe file number
fileSettingThe file setting

Implements logicalaccess::DESFireCommands.

◆ getISO7816ReaderCardAdapter()

std::shared_ptr< ISO7816ReaderCardAdapter > logicalaccess::DESFireISO7816Commands::getISO7816ReaderCardAdapter ( ) const
inline

Get the ISO7816 reader/card adapter.

Returns
The ISO7816 reader/card adapter.

◆ getKeyFromSAM()

void logicalaccess::DESFireISO7816Commands::getKeyFromSAM ( std::shared_ptr< DESFireKey key,
ByteVector  diversify 
) const

retrieve key from SAM AV2 dump key.

◆ getKeyInformations()

ByteVector logicalaccess::DESFireISO7816Commands::getKeyInformations ( std::shared_ptr< DESFireKey key,
uint8_t  keyno 
) const
protected

◆ getKeySettings()

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

Get key settings on the current application.

Parameters
settingsKey settings
maxNbKeysMaximum number of keys

Implements logicalaccess::DESFireCommands.

Reimplemented in logicalaccess::DESFireEV1ISO7816Commands.

◆ getKeyVersion()

uint8_t logicalaccess::DESFireISO7816Commands::getKeyVersion ( uint8_t  keyno)
virtual

Get a key version of a key.

Parameters
keynoThe key no.

◆ getSAMChip()

std::shared_ptr< SAMChip > logicalaccess::DESFireISO7816Commands::getSAMChip ( ) const
inline

get the SAM Chip.

◆ getValue()

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

Get value from a specific value file.

Parameters
handleThe SCardHandle
filenoThe file number
modeThe communicatio mode
valueThe value stored in the card

Implements logicalaccess::DESFireCommands.

◆ getVersion()

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

Get the card version information.

Parameters
dataVersionThe card version information structure that will be filled

Implements logicalaccess::DESFireCommands.

◆ handleReadData()

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

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 in logicalaccess::DESFireEV1ISO7816Commands.

◆ handleWriteData()

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

Generic method to write data into a file.

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

Reimplemented in logicalaccess::DESFireEV1ISO7816Commands.

◆ limitedCredit()

void logicalaccess::DESFireISO7816Commands::limitedCredit ( unsigned char  fileno,
int32_t  value,
EncryptionMode  mode 
)
overridevirtual

Limit credit on a specific value file.

Parameters
handleThe SCardHandle
filenoThe file number
valueThe value to limit credit
modeThe communication mode

Implements logicalaccess::DESFireCommands.

◆ readData()

ByteVector logicalaccess::DESFireISO7816Commands::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::DESFireISO7816Commands::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_authenticate_p1()

ByteVector logicalaccess::DESFireISO7816Commands::sam_authenticate_p1 ( std::shared_ptr< DESFireKey key,
ByteVector  rndb,
ByteVector  diversify 
) const

◆ sam_authenticate_p2()

void logicalaccess::DESFireISO7816Commands::sam_authenticate_p2 ( unsigned char  keyno,
ByteVector  rndap 
) const

◆ selectApplication()

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

Select an application.

Parameters
aidThe Application ID

Implements logicalaccess::DESFireCommands.

◆ setChip()

void logicalaccess::DESFireISO7816Commands::setChip ( std::shared_ptr< Chip chip)
overridevirtual

Override setChip() so we can steal the DESFireProfile and forward it to the crypto context.

Reimplemented from logicalaccess::Commands.

◆ setSAMChip()

void logicalaccess::DESFireISO7816Commands::setSAMChip ( std::shared_ptr< SAMChip t)
inline

Set the SAM Chip.

Parameters
tThe SAM Chip.

◆ transmit() [1/2]

ISO7816Response logicalaccess::DESFireISO7816Commands::transmit ( unsigned char  cmd,
const ByteVector data = 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.

Reimplemented in logicalaccess::DESFireEV1ISO7816Commands.

◆ transmit() [2/2]

ISO7816Response logicalaccess::DESFireISO7816Commands::transmit ( unsigned char  cmd,
unsigned char  lc 
)
protectedvirtual

Transmit a command.

Parameters
cmdThe command code.
lcUndocumented.
Returns
The response.

◆ writeData()

void logicalaccess::DESFireISO7816Commands::writeData ( unsigned char  fileno,
unsigned int  offset,
const ByteVector data,
EncryptionMode  mode 
)
overridevirtual

Write data into a specific file.

Parameters
filenoThe file number
offsetThe byte offset
dataThe data buffer
modeThe communication mode

Implements logicalaccess::DESFireCommands.

◆ writeRecord()

void logicalaccess::DESFireISO7816Commands::writeRecord ( unsigned char  fileno,
unsigned int  offset,
const ByteVector data,
EncryptionMode  mode 
)
overridevirtual

Write record into a specific record file.

Parameters
filenoThe file number
offsetThe byte offset
lengthThe length to write
dataThe data buffer
modeThe communication mode

Implements logicalaccess::DESFireCommands.

Member Data Documentation

◆ d_SAM_chip

std::shared_ptr<SAMChip> logicalaccess::DESFireISO7816Commands::d_SAM_chip
protected

The SAMChip used for the SAM Commands.


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