MIFARE DESFire ® C console software example
Step by step overview of the MIFARE DESFire ® C console software example.
1. Application overview
When you start application, it looks like this:
Key for authentication, AID, AID key number for authentication, File ID and internal key index are read out from config.txt file.
1.1. Config file explanation (config.txt)
Configuration file config.txt is loaded when the application starts. There are key for authentication, AID, ordinal number of key in AID for authentication, File ID and internal key index (when key stored into reader).
DES key: 0000000000000000
AID 3 bytes hex: 000000
AID key number for auth: 0
File ID: 1
Internal key number: 0
First line contains key type, and hexadecimal value of key.
If key type is DES (8 bytes) then 16 characters must be entered (DES key: 0102030405060708)
If key type is 2K3DES (16 bytes) then 32 characters must be entered (2K3DES key: 01020304050607080910111213141516)
If key type is 3K3DES (24 bytes) then 48 characters must be entered (3K3DES key: 010203040506070809101112131415161718192021222324)
If key type is AES (16 bytes) then 32 characters must be entered (AES key: 01020304050607080910111213141516)
Second line contains AID, 6 characters must be entered (AID 3 bytes hex: 010203)
Third line contains ordinal number in application for authentication (0 to maximal number of application keys – 1)
Fourth line contains index of File ID in application. If the function don’t use this parameter, then this value be ignored.
Fifth line contains ordinal number of key for authentication stored into reader.
Configuration file can be changed from application when ‘t’ pressed (Change config parameters).
First, you will see current config.txt file with options 1 – 5 for changing and esc for back to main menu.
For key changing press ‘1’. There are four types of key for authentication.
For example press ‘3’ for 3K3DES key. Enter 24 bytes in hexadecimal format (48 characters).
When the changing is over, press ESC button for return in main menu, and then press ‘t’ for modification checking.
The type and value of authentication key is changed.
1.2. Change authentication mode (0)
For switching between internal or provided key authentication, press ‘0’ on keyboard.
It looks like this (here is ‘0’ pressed twice):
1.3. Master key authentication (1)
For switching between master key authentication, press ‘1’ on keyboard.
It looks like this (here is ‘1’ pressed twice):
Whether authentication is required or not, depends on the master key of the card or application settings.
1.4. Get card UID (2)
For card UID (7 bytes) press ‘2’. Valid authentication with master or application key is required.
1.5. Format card (3)
Pressing number ‘3’ on your keyboard will cause formatting card (deleting all applications and files except AID with number: 000000).
Depends on which authentication mode you chose, it will look for AES key into reader (INTERNAL KEY) or in config.txt file (PROVIDED KEY).
1.6. DES to AES (4)
Changing the card master key from factory DES key 0x0000000000000000 to AES key 0x00000000000000000000000000000000.
1.7. AES to DES (5)
Changing the card master key from AES key 0x00000000000000000000000000000000 to DES key 0x0000000000000000.
1.8. Get free memory (6)
Read the quantity of available memory on the card.
1.9. Set random ID (7)
Activating the random ID card options by Set Random ID button. Required authentication using card master key.
The card returns 4 bytes random ID instead 7 bytes unique ID.
Warning: this operation is irreversible.
When this option is activated, the UID can be read by special command that requires authentication using valid key.
1.10. Internal key lock (8)
You have to enter password (8 characters length) to lock keys enrollment. Factory password is “11111111”.
1.11. Internal key unlock (9)
To unlock the possibility to enroll keys into reader, you must enter the same password to unlock keys which is entered to lock keys enrollment. Factory password is “11111111”
1.12. Set baud rate (a)
After activating the option ‘Set baud rate’ by pressing ‘a’ on keyboard you will see multiple choices to choose for transceive and receive baud rate. Just enter the number next to option you want to choose.
1.13. Get baud rate (b)
Read values of transmit and receive baud rate of reader.
1.14. Store key into reader (c)
First choice the type of key.
For example choice 3K3DES key. Key 0x010203040506070809101112131415161718192021222324.
Internal key index is 0. For 3K3DES keys two key fields into reader will be occupied. In this case 0 and 1. First free key index is 2. For other key types just one key field will be used.
1.15. Change key (d)
Changing card master, and application master and user keys. When changing master key, then may be change the key type and value of key. Into application all keys are same type, and key type don’t be changed.
For example change master key to 3K3DES type, and value 0x010203040506070809101112131415161718192021222324.
1.16. Change key setting (e)
For changing key settings, carefully read available settings and chose one. Take care about setting you chose, some of them cannot be changeable anymore. If you are changing settings for AID 000000 – IT CAN’T BE FORMATTED.
1.17. Get key setting (f)
Read card master or application master key settings and maximal number of application keys. For example read card master key settings.
1.18. Make application (g)
For example make application with AES keys. AID = 0xA10000. Maximal key number 3.
1.19. Delete application (h)
Enter AID to delete.
1.20. Make file (j)
In configuration file set the AID and application master key.
For example make Standard Data File, size 100 bytes, enciphered communication.
Example: Make value file. Lower limit is 0, upper limit is 200, initial value is 100. Enciphered communication mode.
Example: Make linear record file. Size of record is 100, maximal number of records is 3, enciphered communication mode.
1.21. Delete file (k)
In configuration file set the AID, and application master key. Enter File ID for deleting.
1.22. Write Std file or Record (l)
In configuration file set the AID, application key for Write or Read&Write access, and File ID.
For example write text to Standard data file, enciphered communication mode. Text read from file write.txt. Size of text must be less or equal to size of file.
Example: Write record file.
1.23. Read Std file or Records (m)
In configuration file set the AID, application master key, and File ID.
For example read data from Standard data file, enciphered communication mode. Read data will be saved into read.txt file.
Example: Read two records.
1.24. Read value file (n)
In the configuration file set authentication key, AID, AID key number for reading, and File ID.
1.25. Increase value file (o)
In the configuration file set authentication key, AID, AID key number for Read&Write access, and File ID.
Example: Increase value file by 20.
1.26. Decrease value file (p)
In the configuration file set authentication key, AID, AID key number for Read, Write or Read&Write access, and File ID.
Example: Decrease value file by 20.
1.27. Clear record file (r)
In the configuration file set authentication key, AID, AID key number for Read&Write access, and File ID. All records in the Linear or Cyclic Record file will be deleted.
1.28. Get Application AIDs (s)
In the configuration file set card master authentication key, AID = 0x000000.
To browse or download other software examples visit our Gitlab Software repository.
For purchasing our devices, visit our official online store.
Feel free to contact our technical support if you have any questions about our software examples.