MIFARE® Card Programming - µFR Advanced Software SDK

Advanced MIFARE® Cards reading & writing source code software example

MIFARE SDK is available in the following programming languages

  • Java (including Applet),
  • JavaScript,
  • Lazarus,
  • Borland Delphi,
  • C++ Builder,
  • Microsoft® Visual C++ .NET,
  • Microsoft® Visual C# .NET,
  • Microsoft® Visual Basic .NET

Docs & Software Download

LinearWrite, LinearWrite_AKM1, LinearWrite_AKM2, LinearWrite_PK

These functions are used for writing data using the emulation of linear address space. The method for proving authenticity is determined by the suffix in the names of the function:MIFARE SDK - uFR Advanced software with SDK for MIFARE cards tags 1

  • aucData – Pointer to the sequence of bytes containing data for writing
  • usLinearAddress – Linear address  where the data writing is intended
  • usDataLength – Number of bytes for the entry. In aucData, a minimum usDataLength bytes must be allocated before calling the function
  • lpusBytesWritten – Pointer to a “unsigned short” type variable, where the number of successfully read bytes from the card is written. If the entry is successfully completed this data is equal to the usDataLength parameter. If there was an error in writing some of the blocks, the function returns the number of successfully written bytes over this parameter.
  • ucAuthKey – This parameter defines whether to perform authentication with A key or key B. It can have two values, namely: AUTHENT1A (0x60) or AUTHENT1B (0x61).
  • ucReaderKeyIndex – The default method of authentication (when the functions without a suffix is used) performs the authenticity proving by using the selected key index from the RFID reader. In the linear address mode, this applies to all sectors that are written.
 

LinearFormatCard, LinearFormatCard_AKM1, LinearFormatCard_AKM2, LinearFormatCard_PK

These functions are used for new keys A and B writing as well as access bits in the trailers of all sectors. The setting of ninth trailers bytes is enabled (a general-purpose byte where any value can be entered). In all the  sector trailers the same value is set for the entire card so the same keys and access rights are valid. As it is necessary to prove the authenticity on the base of previous keys before writing into the sector trailers, these functions are potentially suitable to initialize the new card (the authentication is performed with transportation keys, all the key bytes are 0xFF) or to re-initialize it with the same keys and access rights for all sectors. Certainly, there must always be careful about the previously set access rights (access bits) in case the changing of some keys or bits for access rights control is disabled.

SectorTrailerWrite

This function group offers greater flexibility in sector trailers initiating:MIFARE SDK - uFR Advanced software with SDK for MIFARE cards tags 2

  • aucNewKeyA – Pointer on 6 bytes array containing a new A key
  • ucBlocksAccessBits – The access bits values that define permissions for all data blocks. It can have values 0 to 7
  • ucSectorTrailersAccessBits – The access bits value that define access permissions for all the sector trailers. It can have values 0 to 7
  • ucSectorTrailersByte9 – The access bits value that define access permissions for all the sector trailers. It can have values 0 to 7
  • aucNewKeyB – Pointer on 6 bytes array containing a new B key
  • lpucSectorsFormatted – Pointer to a “unsigned char” type variable through which the number of successfully formatted sectors trailers returns. Eg. if all the sectors trailers are successfully initialized, on the MIFARE® 1K, through this parameter it returns the value 16 which represents the number of sectors. In case of error the parameter is an indication of the number of successfully initialized sectors starting from zero.
  • ucAuthModeThis parameter defines whether to perform authentication A key or B key. It can have two values, namely: AUTHENT1A (0x60) or AUTHENT1B (0x61).
  • ucReaderKeyIndex – The default method of authentication (when the functions without a suffix is used) performs the authenticity proving by using the selected key index from the RFID reader. In the linear address mode, this applies to all sectors that are written.
  • aucProvidedKey – Pointer to the sixth byte string containing the key for authenticity proving in the “Provided Key” method. _PK Suffix in the name of the function indicates this method usage.
 

Functions for working with data blocks

BlockRead, BlockRead_AKM1, BlockRead_AKM2, BlockRead_PK

This function group is used for block content reading. Always reads the entire block (16bytes of the block). Functions use the so-called bloc addressing (the first block has the address 0; first sector trailer has address 3, the next one 7, etc. until the last MIFARE® 1K block which is also a trailer of the last sector, has an address 63). These functions also allow reading of the sector trailers contents (its available part for reading, depending on the access rights set).

MIFARE SDK - uFR Advanced software with SDK for MIFARE cards tags 3

  • aucData – Pointer to the number of bytes where read data will be stored. Must be allocated at least 16 bytes before calling the function.
  • ucBlockAddress – ucAuthMode block address. This parameter defines whether to perform authentication A key or B key. It can have two values, namely: AUTHENT1A (0x60) or AUTHENT1B (0x61).
  • ucReaderKeyIndex – The default method of authentication (when the functions without a suffix is used) performs the authenticity proving by using the selected key index from the RFID reader. In the linear address mode, this applies to all sectors that are written
  • ucSectorTrailersByte9 – The access bits value that define access permissions for all the sector trailers. It can have values 0 to 7
  • aucProvidedKey – Pointer to the sixth byte array containing the key for authenticity proving in the “Provided Key” method. _PK Suffix in the name of the function indicates this method usage.

These functions work the same as BlockRead group functions and are made for block content reading. The only difference is that the sectoral addressing is used. That includes separately sending sector addresses and block addresses within a sector. For MIFARE® 1K sector address may be in the range 0 to 15, and blocks address within the sector ranging from 0 to 3. For MIFARE® 4k sector address may be in the range of 0 to 39 and since the second half of the address space organization is different (above 2 MB) blocks address in the last 8 sectors (sectors 32 to 39) may be in the range of 0 to 15. The entire block (16-byte block) is always read.

 

These functions can read the sector trailers contents (its available part for reading, depending on the access rights set).

  • aucData – Pointer to the bytes array where read data are going to be stored. At least 16 bytes must be allocated before the function is called
  • ucSectorAddress – Sector Address
  • ucBlockInSectorAddress – Block address within a sector
  • ucAuthMode – This parameter defines whether to perform authentication with A key or B key. It can have two values, namely: AUTHENT1A (0x60) or AUTHENT1B (0x61).
  • ucReaderKeyIndex – The default method of authentication (when the functions without a suffix is used) performs the authenticity proving by using the selected key index from the RFID reader. In the linear address mode, this applies to all sectors that are written
  • aucProvidedKey – Pointer to the sixth-byte array containing the key for authenticity proving in the “Provided Key” method. _PK Suffix in the name of the function indicates this method used.

BlockWrite, BlockWrite_AKM1, BlockWrite_AKM2, BlockWrite_PK

These functions are used for data entry (16 bytes at a time) into the blocks. Functions use the so-called bloc addressing (the first  block has the address 0; first sector trailer has address 3, the next one 7, etc. until the last MIFARE® 1K block which is also a trailer of the last sector, has an address 63). This functions group doesn’t allow direct data enter into the sector trailers. To do so, use the special functions SectorTrailerWrite and SectorTrailerWriteUnsafe.

MIFARE SDK - uFR Advanced software with SDK for MIFARE cards tags 4

  • aucData – Pointer to the number of bytes where read data will be stored. Must be allocated at least 16 bytes before calling the function
  • ucBlockAddress – Card block address
  • ucAuthMode – This parameter defines whether to perform authentication with key A or key B. It can have two values, namely: AUTHENT1A (0x60) or AUTHENT1B (0x61).
  • ucReaderKeyIndex – The default method of authentication (when the functions without a suffix is used) performs the authenticity proving by using the selected key index from the RFID reader. In the linear address mode, this applies to all sectors that are read
  • aucProvidedKey – Pointer to the sixth byte array containing the key for authenticity proving in the “Provided Key” method. _PK Suffix in the name of the function indicates this method usage.
 

FORBIDEN_DIRECT_WRITE_IN_SECTOR_TRAILER.

BlockInSectorWrite, BlockInSectorWrite_AKM1, BlockInSectorWrite_AKM2, BlockInSectorWrite_PK

These functions work the same as BlockWrite group functions; they are used for data entry (16 bytes at a time) into  blocks. The only difference is the use of sector addressing. Sector addressing means separate sending sector and block addresses within a sector. For MIFARE® 1K  sector address may be in the range 0 to 15, and blocks address within the sector ranging from 0 to 3. For MIFARE® 4k sector address may be in the range of 0 to 39 and since the second half of the address space organization is different (above 2 MB) blocks address in the last 8 sectors (sectors 32 to 39) may be in the range of 0 to 15. This functions group doesn’t allow direct data enter into the sector trailers. To do so, use the special functions SectorTrailerWrite and SectorTrailerWriteUnsafeMIFARE SDK - uFR Advanced software with SDK for MIFARE cards tags 5

  • aucData – Pointer to the number of bytes where read data will be stored. Must be allocated at least 16 bytes before calling the function
  • ucSectorAddress – Sector address
  • ucBlockInSectorAddress – This parameter defines whether to perform authentication with A key or B key. It can have two values, namely: AUTHENT1A (0x60) or AUTHENT1B (0x61)
  • ucReaderKeyIndex – The default method of authentication (when the functions without a suffix is used) performs the authenticity proving by using the selected key index from the RFID reader. In the linear address mode, this applies to all sectors that are written
  • aucProvidedKey – Pointer to the sixth byte array containing the key for authenticity proving in the “Provided Key” method. _PK Suffix in the name of the function indicates this method usage.
 

FORBIDEN_DIRECT_WRITE_IN_SECTOR_TRAILER.

SectorTrailerWrite, SectorTrailerWrite_AKM1, SectorTrailerWrite_AKM2, SectorTrailerWrite_PK

These functions are used for data writing in the sector trailers. Functions can also be used for sector trailers block addressing as well as for the sector addressing which is determined by the ucAddressingMode parameter. MIFARE SDK - uFR Advanced software with SDK for MIFARE cards tags 6In the case of block addressing, the first  block has the address 0; trailer has a first sector address 3 and the next 7, etc. until the last block of MIFARE® 1k which is also a trailer of the last sector and has an address 63. This group of functions simplifies the bits manipulation for blocks access rights setting (access bits) and minimizes the possibility of permanent blocking of the whole sector due to incorrect formatting of these bits. Formatting the access bits is made by the RFID reader before the writing. API users can choose the appropriate blocks access rights which are represented by values 0 to 7 and to transmit them to these functions.

 

For sector trailers following access rights are valid:MIFARE SDK - uFR Advanced software with SDK for MIFARE cards tags 7

  • Access bits C1 C2 C3
  • Access values (submitted to the function)
  • Access rights
  • Key A bytes containing the access bits and the nine byte key B
  • Reading and writing
 

For sector trailers following access rights are valid:

* If the access rights for the sector trailer of an appropriate sector set up so that it is possible to readB Key, it cannot be used for authentication in any of the cases. These functions also sets new sector keys if it is permitted to access rights.

  • Access bits C1 C2 C3MIFARE SDK - uFR Advanced software with SDK for MIFARE cards tags 8
  • Access values (submitted to the function)
  • Access rights
  • Reading, writing, increment, decrement
 
  • ucAddressingMode – Specifies the address mode. Possible values of this parameter are BLOCK_ADDRESS_MODE (0x00) or SECTOR_ADDRESS_MODE (0x01). If any other value is sent the function returns an error code WRONG_ADDRESS_MODE
  • ucAddress – Sectors or sector trailers blocks address, depending on ucAddressingMode. When using a sector-address mode, then, for instance, the MIFARE Classic® 1K, the range can be from 0 to 15 ( has 16 sectors). The same  type in the block addressing mode can use the values from 0 to 63 provided that an error occurs if the addressed block is not also the sector trailer.
  • aucNewKeyA – Pointer to the 6 byte array that represents a new A key for a specified sector which will be set if that is previously allowed with the access rights
  • aucNewKeyB – Pointer to the six-byte array that represents a new B key for a specified sector which will be set if that is previously allowed with the access rights
  • ucBlock0AccessBits – Access value for the 0 block of a sector.

MIFARE® 4k has a different organization for the last 8 sectors, the second half of the address space. Therefore, in these sectors the access rights are set as follows:

  • access rights to the first 5 blocks – ucBlock1AccessBits Access value block for the first sector
  • access rights to the second 5 blocks – ucBlock2AccessBits Access value block for the first sector
  • access rights to the last 5 blocks:
    • ucSectorTrailerAccessBits – Access value for a sector trailer
    • ucSectorTrailerByte9 – The ninth sector trailers byte is a byte for general purpose where any single-byte value can be entered
    • ucAuthMode – This parameter defines whether to perform authentication with key A or key B. It can have two values, namely: AUTHENT1A (0x60) or AUTHENT1B (0x61)
    • ucReaderKeyIndex – The default method of authentication (when the functions without a suffix is used) performs the authenticity proving by using the selected key index from the RFID reader. In the linear address mode, this applies to all sectors that are written
    • aucProvidedKey – Pointer to the sixth byte array containing the key for authenticity proving in the “Provided Key” method. _PK Suffix in the name of the function indicates this method usage.

SectorTrailerWriteUnsafe, SectorTrailerWriteUnsafe_AKM1, SectorTrailerWriteUnsafe_AKM2, SectorTrailerWriteUnsafe_PK

These functions have the same purpose as the function of the SectorTrailerWrite group with the difference in sending the “raw” sector trailers content and the errors are possible while formatting access bits values for entering. These functions are intended for developers with experience in working with MIFARE®. All rules mentioned for the SectorTrailerWrite group functions applies to these functions, except the option of the “raw” data for sector trailer entry.

  • ucAddressingMode – Specifies the address mode. Possible values of this parameter are BLOCK_ADDRESS_MODE (0x00) or SECTOR_ADDRESS_MODE (0x01). If any other value is been sent the function returns an error code WRONG_ADDRESS_MODE.
  • ucAddress – Sectors or sector trailers block address, depending on ucAddressingMode.

When using a sector address mode, then, in the case of MIFARE® 1K, the range can be from 0 to 15 ( has 16 sectors) and the same type in block addressing mode can use the values 0 to 63 with the possible error if the addressed block isn’t also the sector trailer.

  • aucSectorTrailer – Pointer to 6 byte array that contains the “raw” data for the address sector trailer entry
  • ucAuthMode – This parameter defines whether to perform authentication key A or key B. It can have two values, namely: AUTHENT1A (0x60) or AUTHENT1B (0x61)
  • ucReaderKeyIndex – The default method of authentication (when the functions without a suffix is used) performs the authenticity proving by using the selected key index from the RFID reader. In the linear address mode, this applies to all sectors that are written
  • aucProvidedKey – Pointer to the sixth byte array containing the key for authenticity proving in the “Provided Key” method. _PK Suffix in the name of the function indicates this method usage.

Functions for working with value blocks

Value blocks represent an optional MIFARE® functionality. This is actually a mode in which the entire block of data  (16 bytes) represents one four-byte value. In this mode, you can add any data block (except of course, block 0, the zero sector and sector trailer). The values in the value blocks are formatted in a special way and in addition to value records contain the one byte address value, which gives users the added ability to implement the backup system.

D-Logic RFID readers takes care of the proper value blocks formatting so the set of functions that handle only with four byte values are available to users. It should be mentioned that the use of value blocks makes sense if the access rights to desired block are set on values 1, 6 or 0 (the default in new card) which allows their values increment and decrement. First of all, value blocks must be initiated, value and associated address must be in compliance with the appropriate format of sixteen byte records. The best and easiest way for value blocks initialization is with a set of Windows API functions IS21 ValueBlockWrite or ValueBlockInSectorWrite.

ValueBlockRead, ValueBlockRead_AKM1, ValueBlockRead_AKM2, ValueBlockRead_PK

These functions do the same as ValueBlockRead group functions and are proper for reading 4 byte values of the value blocks. In addition they return the associated address stored in the value block. The only difference is the use of so-called sectoral addressing. Sectoral addressing means separately sending sector and block addresses within a sector. For MIFARE® 1K sector address may be in the range 0 to 15, and blocks address within the sector ranging from 0 to 3. For MIFARE® 4k sector address may be in the range of 0 to 39 and since the second half of the address space organization is different (above 2 MB) blocks address in the last 8 sectors (sectors 32 to 39) may be in the range of 0 to 15.

MIFARE SDK - uFR Advanced software with SDK for MIFARE cards tags 9

  • lValue – Pointer to a variable of a long type over which the value block returns
  • ucValueAddr – The ninth sector trailers byte is a byte for general purpose where any single-byte value can be entered
  • ucSectorAddress – Sector address
  • ucBlockInSectorAddress – Block address in a sector
  • ucAuthMode – This parameter defines whether to perform authentication key A or key B. It can have two values, namely: AUTHENT1A (0x60) or AUTHENT1B (0x61)
  • ucReaderKeyIndex – e default method of authentication (when the functions without a suffix is used) performs the authenticity proving by using the selected key index from the RFID reader. In the linear address mode it applies to all sectors for writing
  • aucProvidedKey – Pointer to the six-byte array that contains the key for authentication of the “Provided Key” method. _PK function name suffix indicates to the use of this method.
 

ValueBlockInSectorRead, ValueBlockInSectorRead_AKM1, ValueBlockInSectorRead_AKM2, ValueBlockInSectorRead_PK

These functions do the same as ValueBlockRead group functions and are proper for reading 4 byte values of the value blocks. In addition they return the associated address stored in the value block. The only difference is the use of so-called sectoral addressing. Sectoral addressing means separately sending sector and block addresses within a sector. For MIFARE® 1K sector address may be in the range 0 to 15, and blocks address within the sector ranging from 0 to 3. For MIFARE® 4k sector address may be in the range of 0 to 39 and since the second half of the address space organization is different (above 2 MB) blocks address in the last 8 sectors (sectors 32 to 39) may be in the range of 0 to 15.

MIFARE SDK - uFR Advanced software with SDK for MIFARE cards tags 13

  • lValue – Pointer to a variable of a long type over which the value block returns
  • ucValueAddr – Pointer to a variable of unsigned char type is returned via the one byte address which gives the added ability for a backup system implementation
  • ucSectorAddress – Sector address
  • ucBlockInSectorAddress – Block address in a sector
  • ucAuthMode – This parameter defines whether to perform authentication key A or key B. It can have two values, namely: AUTHENT1A (0x60) or AUTHENT1B (0x61)
  • ucReaderKeyIndex – The default method of authentication (when the functions without a suffix is used) performs the authenticity proving by using the selected key index from the RFID reader. In the linear address mode it applies to all sectors for writing
  • aucProvidedKey – Pointer to the six-byte array that contains the key for authentication of the “Provided Key” method. _PK function name suffix indicates to the use of this method.
 
 

ValueBlockWrite, ValueBlockWrite_AKM1, ValueBlockWrite_AKM2, ValueBlockWrite_PK

These functions are used to initialize and write fourth byte value blocks values and store the associated address in the value block. Functions using the so-called block addressing (the first block has the address 0; trailer has a first sector address 3 and the next 7, etc. until the last block of MIFARE® 1k which is also a trailer of the last sector and has an address 63).MIFARE SDK - uFR Advanced software with SDK for MIFARE cards tags 14

  • lValue – Value for the value block entry
  • ucValueAddr – Value block associated address
  • ucBlockAddress – Block address
  • ucAuthMode – This parameter defines whether to perform authentication with A key or B key. It can have two values, namely: AUTHENT1A (0x60) or AUTHENT1B (0x61).
  • ucReaderKeyIndex – The default method of authentication (when the functions without a suffix is used) performs the authenticity proving by using the selected key index from the RFID reader. In the linear address mode, this applies to all sectors that are written
  • aucProvidedKey – Pointer to the sixth byte array containing the key for authenticity proving in the “Provided Key” method. _PK Suffix in the name of the function indicates this method usage.
 
 

ValueBlockInSectorWrite, ValueBlockInSectorWrite_AKM1, ValueBlockInSectorWrite_AKM2, ValueBlockInSectorWrite_PK

These functions are similar to the ValueBlockWrite group functions. They use for entry, value blocks 4 bytes values initialization. In addition, stores the associated address into the block value. The only difference is the sectoral addressing usage. Sectoral addressing means separately sending sector and block addresses within a sector. For MIFARE® 1K  sector address may be in the range 0 to 15, and blocks address within the sector ranging from 0 to 3. For MIFARE® 4k sector address may be in the range of 0 to 39 and since the second half of the address space organization is different (above 2 MB) blocks address in the last 8 sectors (sectors 32 to 39) may be in the range of 0 to 15.MIFARE SDK - uFR Advanced software with SDK for MIFARE cards tags 15

  • lValue – Value for the value block entry
  • ucValueAddr – Value block associated address
  • ucSectorAddress – Sector address
  • ucBlockInSectorAddress – Block address of a sector
  • ucAuthMode – This parameter defines whether to perform authentication key A or key B. It can have two values, namely: AUTHENT1A (0x60) or AUTHENT1B (0x61).
  • ucReaderKeyIndex – The default method of authentication (when the functions without a suffix is used) performs the authenticity proving by using the selected key index from the RFID reader. In the linear address mode it applies to all sectors for writing
  • aucProvidedKey – Pointer to the six-byte array that contains the key for authentication of the “Provided Key” method. _PK function name suffix indicates to the use of this method.
 
 

ValueBlockIncrement, ValueBlockIncrement_AKM1, ValueBlockIncrement_AKM2, ValueBlockIncrement_PK

This feature set is used to increment the value 4 byte value blocks. The value of value block increment is sent as a parameter of these functions. Functions use block addressing (the first  block has the address 0; first sector trailer has address 3, the next one 7, etc. until the last MIFARE® 1K block which is also a trailer of the last sector, has an address 63).MIFARE SDK - uFR Advanced software with SDK for MIFARE cards tags 16

  • lIncrementValue – The value of value block increment
  • ucBlockAddress – Block address in a sector
  • ucSectorAddress – Sector address
  • ucAuthMode – This parameter defines whether to perform authentication key A or key B. It can have two values, namely: AUTHENT1A (0x60) or AUTHENT1B (0x61).
  • ucReaderKeyIndex – The default method of authentication (when the functions without a suffix is used) performs the authenticity proving by using the selected key index from the RFID reader. In the linear address mode it applies to all sectors for writing
  • aucProvidedKey – Pointer to the six-byte array that contains the key for authentication of the “Provided Key” method. _PK function name suffix indicates to the use of this method.
 
 

ValueBlockInSectorIncrement, ValueBlockInSectorIncrement_AKM1, ValueBlockInSectorIncrement_AKM2, ValueBlockInSectorIncrement_PK

These functions have the same purpose as ValueBlockIncrement group functions and are used for reading 4 byte values of the value blocks. The value of value block increment is sent as a parameter of these functions. The only difference is the sectoral addressing usage. Sectoral addressing means separately sending sector and block addresses within a sector. For MIFARE® 1K sector address may be in the range 0 to 15, and blocks address within the sector ranging from 0 to 3. For MIFARE® 4k sector address may be in the range of 0 to 39 and since the second half of the address space organization is different (above 2 MB) blocks address in the last 8 sectors (sectors 32 to 39) may be in the range of 0 to 15.MIFARE SDK - uFR Advanced software with SDK for MIFARE cards tags 17

  • lIncrementValue – The value of value block increment
  • ucSectorAddress – Sector address
  • ucBlockInSectorAddress – Block address within a sector
  • ucAuthMode – This parameter defines whether to perform authentication key A or key B. It can have two values, namely: AUTHENT1A (0x60) or AUTHENT1B (0x61).
  • ucReaderKeyIndex – The default method of authentication (when the functions without a suffix is used) performs the authenticity proving by using the selected key index from the RFID reader. In the linear address mode, it applies to all sectors for writing
  • aucProvidedKey – Pointer to the six-byte array that contains the key for authentication of the “Provided Key” method. _PK function name suffix indicates to the use of this method.
 
 

ValueBlockDecrement, ValueBlockDecrement_AKM1, ValueBlockDecrement_AKM2, ValueBlockDecrement_PK

This set of functions is used to decrement 4 byte value of value blocks. The value of the value block decrement is sent as a parameter of these functions. Functions use block addressing (the first block has the address 0; first sector trailer has address 3, the next one 7, etc. until the last MIFARE® 1K block which is also a trailer of the last sector, has an address 63).MIFARE SDK - uFR Advanced software with SDK for MIFARE cards tags 18

  • lDecrementValue – The value of value block decrement
  • ucBlockAddress – Block address within a sector
  • ucAuthMode – This parameter defines whether to perform authentication key A or key B. It can have two values, namely: AUTHENT1A (0x60) or AUTHENT1B (0x61).
  • ucReaderKeyIndex – The default method of authentication (when the functions without a suffix are used) performs the authenticity proving by using the selected key index from the RFID reader. In the linear address mode, it applies to all sectors for writing
  • aucProvidedKey – Pointer to the six-byte array that contains the key for authentication of the “Provided Key” method. _PK function name suffix indicates the use of this method.
 
 

ValueBlockInSectorDecrement, ValueBlockInSectorDecrement_AKM1, ValueBlockInSectorDecrement_AKM2, ValueBlockInSectorDecrement_PK

These functions work the same as ValueBlockDecrement group functions and are made for the value blocks 4 byte values decrement. The value of the value block decrement is sent as a parameter to these functions. Only difference is the sectoral addressing usage. That includes separately sending sector addresses and block addresses within a sector. For MIFARE® 1K sector address may be in the range 0 to 15, and blocks address within the sector ranging from 0 to 3. For MIFARE® 4k sector address may be in the range of 0 to 39 and since the second half of the address space organization is different (above 2 MB) blocks address in the last 8 sectors (sectors 32 to 39) may be in the range of 0 to 15MIFARE SDK - uFR Advanced software with SDK for MIFARE cards tags 19

  • lDecrementValue – The value of value block decrement
  • ucSectorAddress – Sector address
  • ucBlockInSectorAddress – Block address within a sector
  • ucAuthMode – This parameter defines whether to perform authentication key A or key B. It can have two values, namely: AUTHENT1A (0x60) or AUTHENT1B (0x61).
  • ucReaderKeyIndex – The default method of authentication (when the functions without a suffix is used) performs the authenticity proving by using the selected key index from the RFID reader. In the linear address mode it applies to all sectors for writing
  • aucProvidedKey – Pointer to the six-byte array that contains the key for authentication of the “Provided Key” method. _PK function name suffix indicates to the use of this method.