NAME
DesfireAPI :: Data management of DesFire cards
COPYRIGHT
(c) 2009 SpringCard - www.springcard.com
DESCRIPTION
Get/Set data on DesFire cards For Mifare DesFire MF3 IC D40 cards
NAME
Desfire_ClearRecordFile
DESCRIPTION
Allows to reset a Cyclic or Linear Record File to the empty state
SYNOPSIS
[[sprox_desfire.dll]] SWORD SPROX_Desfire_ClearRecordFile(BYTE file_id); [[sprox_desfire_ex.dll]] SWORD SPROXx_Desfire_ClearRecordFile(SPROX_INSTANCE rInst, BYTE file_id); [[pcsc_desfire.dll]] LONG SCardDesfire_ClearRecordFile(SCARDHANDLE hCard, BYTE file_id);
INPUTS
BYTE file_id : File IDentifier
RETURNS
DF_OPERATION_OK : success, data has been written Other code if internal or communication error has occured.
NOTES
Full "Read&Write" permission on the file is necessary for executing this command
NAME
Credit
DESCRIPTION
Allows to increase a value stored in a Value File.
SYNOPSIS
[[sprox_desfire.dll]] SWORD SPROX_Desfire_Credit(BYTE file_id, BYTE comm_mode, SDWORD amount); [[sprox_desfire_ex.dll]] SWORD SPROXx_Desfire_Credit(SPROX_INSTANCE rInst, BYTE file_id, BYTE comm_mode, SDWORD amount); [[pcsc_desfire.dll]] LONG SCardDesfire_Credit(SCARDHANDLE hCard, BYTE file_id, BYTE comm_mode, SDWORD amount);
INPUTS
BYTE file_id : File IDentifier BYTE comm_mode : file's communication settings (DF_COMM_MODE_PLAIN, DF_COMM_MODE_MACED, DF_COMM_MODE_PLAIN2 or DF_COMM_MODE_ENCIPHERED)(see chapter 3.2 of datasheet of mifare DesFire MF3ICD40 for more information) SDWORD amount : amount to increase to the current value stored in the file. Only positive values allowed.
RETURNS
DF_OPERATION_OK : success, data has been written Other code if internal or communication error has occured.
NOTES
The Credit command requires Authentication with the key specified for "Read&Write" access.
SEE ALSO
Credit2
NAME
Credit2
DESCRIPTION
Allows to increase a value stored in a Value File.
SYNOPSIS
[[sprox_desfire.dll]] SWORD SPROX_Desfire_Credit2(BYTE file_id, SDWORD amount); [[sprox_desfire_ex.dll]] SWORD SPROXx_Desfire_Credit2(SPROX_INSTANCE rInst, BYTE file_id, SDWORD amount); [[pcsc_desfire.dll]] LONG SCardDesfire_Credit2(SCARDHANDLE hCard, BYTE file_id, SDWORD amount);
INPUTS
BYTE file_id : File IDentifier SDWORD amount : amount to increase to the current value stored in the file. Only positive values allowed.
RETURNS
DF_OPERATION_OK : success, data has been written Other code if internal or communication error has occured.
NOTES
The Credit command requires Authentication with the key specified for "Read&Write" access.
SEE ALSO
Credit
NAME
Debit
DESCRIPTION
Allows to decrease a value stored in a Value File.
SYNOPSIS
[[sprox_desfire.dll]] SWORD SPROX_Desfire_Debit(BYTE file_id, BYTE comm_mode, SDWORD amount); [[sprox_desfire_ex.dll]] SWORD SPROXx_Desfire_Debit(SPROX_INSTANCE rInst, BYTE file_id, BYTE comm_mode, SDWORD amount); [[pcsc_desfire.dll]] LONG SCardDesfire_Debit(SCARDHANDLE hCard, BYTE file_id, BYTE comm_mode, SDWORD amount);
INPUTS
BYTE file_id : File IDentifier BYTE comm_mode : file's communication settings (DF_COMM_MODE_PLAIN, DF_COMM_MODE_MACED, DF_COMM_MODE_PLAIN2 or DF_COMM_MODE_ENCIPHERED)(see chapter 3.2 of datasheet of mifare DesFire MF3ICD40 for more information) SDWORD amount : amount to decrease to the current value stored in the file. Only positive values allowed.
RETURNS
DF_OPERATION_OK : success, data has been written Other code if internal or communication error has occured.
NOTES
The Credit command requires Authentication with the key specified for "Read", "Write" ord "Read&Write" access.
SEE ALSO
Debit2
NAME
Debit2
DESCRIPTION
Allows to decrease a value stored in a Value File.
SYNOPSIS
[[sprox_desfire.dll]] SWORD SPROX_Desfire_Debit2(BYTE file_id, SDWORD amount); [[sprox_desfire_ex.dll]] SWORD SPROXx_Desfire_Debit2(SPROX_INSTANCE rInst, BYTE file_id, SDWORD amount); [[pcsc_desfire.dll]] LONG SCardDesfire_Debit2(SCARDHANDLE hCard, BYTE file_id, SDWORD amount);
INPUTS
BYTE file_id : File IDentifier SDWORD amount : amount to decrease to the current value stored in the file. Only positive values allowed.
RETURNS
DF_OPERATION_OK : success, data has been written Other code if internal or communication error has occured.
NOTES
The Credit command requires Authentication with the key specified for "Read", "Write" ord "Read&Write" access.
SEE ALSO
Debit
NAME
GetValue
DESCRIPTION
Allows to read current stored value from Value Files
SYNOPSIS
[[sprox_desfire.dll]] SWORD SPROX_Desfire_GetValue(BYTE file_id, BYTE comm_mode, SDWORD *value); [[sprox_desfire_ex.dll]] SWORD SPROXx_Desfire_GetValue(SPROX_INSTANCE rInst, BYTE file_id, BYTE comm_mode, SDWORD *value); [[pcsc_desfire.dll]] LONG SCardDesfire_GetValue(SCARDHANDLE hCard, BYTE file_id, BYTE comm_mode, SDWORD *value);
INPUTS
BYTE file_id : File IDentifier BYTE comm_mode : file's communication settings (DF_COMM_MODE_PLAIN, DF_COMM_MODE_MACED, DF_COMM_MODE_PLAIN2 or DF_COMM_MODE_ENCIPHERED)(see chapter 3.2 of datasheet of mifare DesFire MF3ICD40 for more information) SDWORD *value : pointer to receive current value
RETURNS
DF_OPERATION_OK : success, value has been read Other code if internal or communication error has occured.
SEE ALSO
GetValue2
NAME
GetValue2
DESCRIPTION
Allows to read current stored value from Value Files
SYNOPSIS
[[sprox_desfire.dll]] SWORD SPROX_Desfire_GetValue2(BYTE file_id, SDWORD *value); [[sprox_desfire_ex.dll]] SWORD SPROXx_Desfire_GetValue2(SPROX_INSTANCE rInst, BYTE file_id, SDWORD *value); [[pcsc_desfire.dll]] LONG SCardDesfire_GetValue2(SCARDHANDLE hCard, BYTE file_id, SDWORD *value);
INPUTS
BYTE file_id : File IDentifier SDWORD *value : pointer to receive current value
RETURNS
DF_OPERATION_OK : success, value has been read Other code if internal or communication error has occured.
SEE ALSO
GetValue
NAME
LimitedCredit
DESCRIPTION
Allows a limited increase of a value stored in a Value File without having full Read&Write permissions to the file. This feature can be enabled or disabled during value file creation.
SYNOPSIS
[[sprox_desfire.dll]] SWORD SPROX_Desfire_LimitedCredit(BYTE file_id, BYTE comm_mode, SDWORD amount); [[sprox_desfire_ex.dll]] SWORD SPROXx_Desfire_LimitedCredit(SPROX_INSTANCE rInst, BYTE file_id, BYTE comm_mode, SDWORD amount); [[pcsc_desfire.dll]] LONG SCardDesfire_LimitedCredit(SCARDHANDLE hCard, BYTE file_id, BYTE comm_mode, SDWORD amount);
INPUTS
BYTE file_id : File IDentifier BYTE comm_mode : file's communication settings (DF_COMM_MODE_PLAIN, DF_COMM_MODE_MACED, DF_COMM_MODE_PLAIN2 or DF_COMM_MODE_ENCIPHERED)(see chapter 3.2 of datasheet of mifare DesFire MF3ICD40 for more information) SDWORD amount : amount to increase to the current value stored in the file. Only positive values allowed.
RETURNS
DF_OPERATION_OK : success, data has been written Other code if internal or communication error has occured.
SEE ALSO
LimitedCredit2
NAME
LimitedCredit2
DESCRIPTION
Allows a limited increase of a value stored in a Value File without having full Read&Write permissions to the file. This feature can be enabled or disabled during value file creation.
SYNOPSIS
[[sprox_desfire.dll]] SWORD SPROX_Desfire_LimitedCredit2(BYTE file_id, SDWORD amount); [[sprox_desfire_ex.dll]] SWORD SPROXx_Desfire_LimitedCredit2(SPROX_INSTANCE rInst, BYTE file_id, SDWORD amount); [[pcsc_desfire.dll]] LONG SCardDesfire_LimitedCredit2(SCARDHANDLE hCard, BYTE file_id, SDWORD amount);
INPUTS
BYTE file_id : File IDentifier SDWORD amount : amount to increase to the current value stored in the file. Only positive values allowed.
RETURNS
DF_OPERATION_OK : success, data has been written Other code if internal or communication error has occured.
SEE ALSO
LimitedCredit
NAME
ReadData
DESCRIPTION
Allows to read data from Standard Data File or Backup Data File
SYNOPSIS
[[sprox_desfire.dll]] SWORD SPROX_Desfire_ReadData(BYTE file_id, BYTE comm_mode, DWORD from_offset, DWORD max_count, BYTE data[], DWORD *done_count); [[sprox_desfire_ex.dll]] SWORD SPROXx_Desfire_ReadData(SPROX_INSTANCE rInst, BYTE file_id, BYTE comm_mode, DWORD from_offset, DWORD max_count, BYTE data[], DWORD *done_count); [[pcsc_desfire.dll]] LONG SCardDesfire_ReadData(SCARDHANDLE hCard, BYTE file_id, BYTE comm_mode, DWORD from_offset, DWORD max_count, BYTE data[], DWORD *done_count);
INPUTS
BYTE file_id : File IDentifier BYTE comm_mode : file's communication settings (DF_COMM_MODE_PLAIN, DF_COMM_MODE_MACED, DF_COMM_MODE_PLAIN2 or DF_COMM_MODE_ENCIPHERED)(see chapter 3.2 of datasheet of mifare DesFire MF3ICD40 for more information) DWORD from_offset : starting position for the read operation DWORD max_count : maximum data length to read. Set to 0 to read whole file BYTE data[] : buffer to receive the data DWORD *done_count : actual data length read
RETURNS
DF_OPERATION_OK : success, data has been read Other code if internal or communication error has occured.
SEE ALSO
ReadData2
NAME
ReadData2
DESCRIPTION
Allows to read data from Standard Data File or Backup Data File
SYNOPSIS
[[sprox_desfire.dll]] SWORD SPROX_Desfire_ReadData2(BYTE file_id, DWORD from_offset, DWORD max_count, BYTE data[], DWORD *done_count); [[sprox_desfire_ex.dll]] SWORD SPROXx_Desfire_ReadData2(SPROX_INSTANCE rInst, BYTE file_id, DWORD from_offset, DWORD max_count, BYTE data[], DWORD *done_count); [[pcsc_desfire.dll]] LONG SCardDesfire_ReadData2(SCARDHANDLE hCard, BYTE file_id, DWORD from_offset, DWORD max_count, BYTE data[], DWORD *done_count);
INPUTS
BYTE file_id : File IDentifier DWORD from_offset : starting position for the read operation in bytes DWORD max_count : maximum data length to read. Set to 0 to read whole file BYTE data[] : buffer to receive the data DWORD *done_count : actual data length read
RETURNS
DF_OPERATION_OK : success, data has been read Other code if internal or communication error has occured.
SEE ALSO
ReadData
NAME
ReadRecords
DESCRIPTION
Allows to read data out a set of complete records from a Cyclic or Linear Record File.
SYNOPSIS
[[sprox_desfire.dll]] SWORD SPROX_Desfire_ReadRecords(BYTE file_id, BYTE comm_mode, DWORD from_record, DWORD max_record_count, DWORD record_size, BYTE data[], DWORD *record_count); [[sprox_desfire_ex.dll]] SWORD SPROXx_Desfire_ReadRecords(SPROX_INSTANCE rInst, BYTE file_id, BYTE comm_mode, DWORD from_record, DWORD max_record_count, DWORD record_size, BYTE data[], DWORD *record_count); [[pcsc_desfire.dll]] LONG SCardDesfire_ReadRecords(SCARDHANDLE hCard, BYTE file_id, BYTE comm_mode, DWORD from_record, DWORD max_record_count, DWORD record_size, BYTE data[], DWORD *record_count);
INPUTS
BYTE file_id : File IDentifier BYTE comm_mode : file's communication settings (DF_COMM_MODE_PLAIN, DF_COMM_MODE_MACED, DF_COMM_MODE_PLAIN2 or DF_COMM_MODE_ENCIPHERED)(see chapter 3.2 of datasheet of mifare DesFire MF3ICD40 for more information) DWORD from_record : offset of the newest record to read. Set to 0 for latest record DWORD max_record_count : number of records to be read from the PICC. Set to 0 to read all records. DWORD record_size : size of the record in bytes BYTE data[] : buffer to receive the data DWORD *record_count : actual number of records read
RETURNS
DF_OPERATION_OK : success, data has been read Other code if internal or communication error has occured.
SEE ALSO
ReadRecords2
NAME
ReadRecords2
DESCRIPTION
Allows to read data out a set of complete records from a Cyclic or Linear Record File.
SYNOPSIS
[[sprox_desfire.dll]] SWORD SPROX_Desfire_ReadRecords2(BYTE file_id, DWORD from_record, DWORD max_record_count, DWORD record_size, BYTE data[], DWORD *record_count); [[sprox_desfire_ex.dll]] SWORD SPROXx_Desfire_ReadRecords2(SPROX_INSTANCE rInst, BYTE file_id, DWORD from_record, DWORD max_record_count, DWORD record_size, BYTE data[], DWORD *record_count); [[pcsc_desfire.dll]] LONG SCardDesfire_ReadRecords2(SCARDHANDLE hCard, BYTE file_id, BYTE comm_mode, DWORD from_record, DWORD max_record_count, DWORD record_size, BYTE data[], DWORD *record_count);
INPUTS
BYTE file_id : File IDentifier DWORD from_record : offset of the newest record to read. Set to 0 for latest record DWORD max_record_count : number of records to be read from the PICC. Set to 0 to read all records. DWORD record_size : size of the record in bytes BYTE data[] : buffer to receive the data DWORD *record_count : actual number of records read
RETURNS
DF_OPERATION_OK : success, data has been read Other code if internal or communication error has occured.
SEE ALSO
ReadRecords
NAME
WriteData
DESCRIPTION
Allows to write data from Standard Data File or Backup Data File
SYNOPSIS
[[sprox_desfire.dll]] SWORD SPROX_Desfire_WriteData(BYTE file_id, BYTE comm_mode, DWORD from_offset, DWORD size, const BYTE data[]); [[sprox_desfire_ex.dll]] SWORD SPROXx_Desfire_WriteData(SPROX_INSTANCE rInst, BYTE file_id, BYTE comm_mode, DWORD from_offset, DWORD size, const BYTE data[]); [[pcsc_desfire.dll]] LONG SCardDesfire_WriteData(SCARDHANDLE hCard, BYTE file_id, BYTE comm_mode, DWORD from_offset, DWORD size, const BYTE data[]);
INPUTS
BYTE file_id : File IDentifier BYTE comm_mode : file's communication settings (DF_COMM_MODE_PLAIN, DF_COMM_MODE_MACED, DF_COMM_MODE_PLAIN2 or DF_COMM_MODE_ENCIPHERED)(see chapter 3.2 of datasheet of mifare DesFire MF3ICD40 for more information) DWORD from_offset : starting position for the write operation in bytes DWORD size : size of the buffer in bytes BYTE data[] : buffer to write to the card
RETURNS
DF_OPERATION_OK : success, data has been written Other code if internal or communication error has occured.
SEE ALSO
WriteData2
NAME
WriteData2
DESCRIPTION
Allows to write data from Standard Data File or Backup Data File
SYNOPSIS
[[sprox_desfire.dll]] SWORD SPROX_Desfire_WriteData2(BYTE file_id, DWORD from_offset, DWORD size, const BYTE data[]); [[sprox_desfire_ex.dll]] SWORD SPROXx_Desfire_WriteData2(SPROX_INSTANCE rInst, BYTE file_id, DWORD from_offset, DWORD size, const BYTE data[]); [[pcsc_desfire.dll]] LONG SCardDesfire_WriteData2(SCARDHANDLE hCard, BYTE file_id, DWORD from_offset, DWORD size, const BYTE data[]);
INPUTS
BYTE file_id : File IDentifier DWORD from_offset : starting position for the write operation in bytes DWORD size : size of the buffer in bytes BYTE data[] : buffer to write to the card
RETURNS
DF_OPERATION_OK : success, data has been written Other code if internal or communication error has occured.
SEE ALSO
WriteData
NAME
WriteRecord
DESCRIPTION
Allows to write data to a record in a Cyclic or Linear Record File.
SYNOPSIS
[[sprox_desfire.dll]] SWORD SPROX_Desfire_WriteRecord(BYTE file_id, BYTE comm_mode, DWORD from_offset, DWORD size, const BYTE data[]); [[sprox_desfire_ex.dll]] SWORD SPROXx_Desfire_WriteRecord(SPROX_INSTANCE rInst, BYTE file_id, BYTE comm_mode, DWORD from_offset, DWORD size, const BYTE data[]); [[pcsc_desfire.dll]] LONG SCardDesfire_WriteRecord(SCARDHANDLE hCard, BYTE file_id, BYTE comm_mode, DWORD from_offset, DWORD size, const BYTE data[]);
INPUTS
BYTE file_id : File IDentifier BYTE comm_mode : file's communication settings (DF_COMM_MODE_PLAIN, DF_COMM_MODE_MACED, DF_COMM_MODE_PLAIN2 or DF_COMM_MODE_ENCIPHERED)(see chapter 3.2 of datasheet of mifare DesFire MF3ICD40 for more information) DWORD from_offset : offset within one single record in bytes DWORD size : size data to be written in bytes BYTE data[] : buffer containing the data to write
RETURNS
DF_OPERATION_OK : success, data has been written Other code if internal or communication error has occured.
SEE ALSO
WriteRecord2
NAME
WriteRecord2
DESCRIPTION
Allows to write data to a record in a Cyclic or Linear Record File.
SYNOPSIS
[[sprox_desfire.dll]] SWORD SPROX_Desfire_WriteRecord2(BYTE file_id, DWORD from_offset, DWORD size, const BYTE data[]); [[sprox_desfire_ex.dll]] SWORD SPROXx_Desfire_WriteRecord2(SPROX_INSTANCE rInst, BYTE file_id, DWORD from_offset, DWORD size, const BYTE data[]); [[pcsc_desfire.dll]] LONG SCardDesfire_WriteRecord2(SCARDHANDLE hCard, BYTE file_id, DWORD from_offset, DWORD size, const BYTE data[]);
INPUTS
BYTE file_id : File IDentifier DWORD from_offset : offset within one single record in bytes DWORD size : size data to be written in bytes BYTE data[] : buffer containing the data to write
RETURNS
DF_OPERATION_OK : success, data has been written Other code if internal or communication error has occured.
SEE ALSO
WriteRecord