|
IS21 Series MIFARE® card reader - Win API (Application Programming Interface) IS21 series of readers operates with Mifare® Classic contactless card series which communication interface is compliant to ISO / IEC 14443 A standard. Since the MIFARE® cards have a lot of specifics that are not supported by any standard Windows API, IS21 Series MIFARE® card readers are supplied with separate API interface placed in the DLL called is21.dll. |
||
|
Alternatively this reader can communicate over a virtual COM port using appropriate available IS21-VCOM protocol. In this way, IS21 readers can be used on any platform for which there is still no direct software support (Mac OS X, Linux, Linux x86_64, Windows CE (4.2, 5.2, 6.0 for a range of processors), Windows Mobile (version 5 and 6 for x86), Pocket PC 2003 (x86 and ARM / XScale processor)). API specification (applies to the IS21-VCOM protocol) contains functions that: ● emulate linear address space on the MIFARE® cards, This way of data addressing is performed in accordance with the manufacturer's documentation for addressing the MIFARE® card. |
|
Allows four methods of authentication for card data access: ● “Reader key authentication” - the default authentication mode. For this mode the keys are stored into the reader (with a maximum of 32 key with indexes from 0 to 31) and the key index is sent with related functions. In the case of functions that emulate linear address space in this method of authentication, the use of the same key for all sectors (or at least for those who are in default range for linear addressing) is default. |
|
|
● “Automatic key mode 1” (AKM1) and “Automatic key mode 2” (AKM2) are optional, automatic modes of authentication. This modes enable automatic selection of keys stored in the reader on the basis of the block address or a combination of block and sector address within the sector. These modes could be used in emulation of a linear address space because after the address conversion in the readers software it is performed automatic keys selection for the authentication of a block or sector. The difference between AKM1 and AKM2 is only in the way of automatic selection of A and B keys performing. |
|
When using AKM1 mode it is accepted that the index keys in the reader from 0 to 15 are appropriate with A sectors keys from 0 to 15 and the index keys in the reader from 16 to 31 are appropriate with B sectors keys from 0 to 15. When used AKM2 mode, even key indexes in the reader (0, 2, ..., 28, 30) are accepted as a sectors keys from 0 to 15 respectively and the odd key indexes in the reader are accepted as B sectors keys from 0 to 15. This is certainly true for Mifare ® 1K. For MIFARE ® card MINI only the first five keys A and B can be used (in AKM1 key index from 0 to 4 for A keys and from 16 to 20 for B keys, in AKM2 mode for A key index 0, 2, 4, 6 and 8 and for B keys 1, 3, 5, 7 and 9) because this cards contain only that much sectors. On MIFARE® 4K there are 40 sectors so the lower and upper address space are organized into the 2K. With these cards AKM1 and AKM2 modes are organized in such a way that the same keys indexes from the reader corresponding sectors 0 to 15 and 16 to 32. For the last 8 sectors (sectors 32 to 39) the same readers keys are used that correspond to sectors 0 to 7 and 16 to 23. |
![]() |
The last method of authentication is "Provided key" (PK). In this mode, you do not use keys stored in the reader but the keys are sent directly from the code with API functions. This mode does not provide any security, so its use is not recommended except under strictly controlled conditions or for testing purposes. |
|
A special function for the sector trailer blocks card entry is implemented which is a very simplified calculation of the bytes values containing the access bits. This avoids the danger of permanently blocking the entire sectors of the card due to wrong bits format which controls access to blocks of a sector. For those with more experience in working with MIFARE cards, the so-called unsafe option is left for the sector trailer blocks manipulation. ● There is a method for linear emulation mode, which formats the card sector trailer blocks in the same way ie. sets a unique keys and access bits for the entire card. This is a very simplified way of the card initialization for linear approach. ● API contains a set of functions for manipulating the cards value blocks. Four-byte values read and write are supported with a value blocks automatically formatted for the appropriate specification. The increment and decrement blocks value is also supported. |
||
|
|
|
General functions for working with the reader
GetReaderType: Returns the device type identifier. On IS21 readers this value is 0xD1150021. GetReaderSerialNumber: Returns the device serial number. ReaderSoftRestart: Reader is restarted by software. This function sets all readers operating parameters to the default values and resets the close RF field, which practically resets all the cards in the field. ReaderReset: Resets all the digital logic of readers hardware. This function can generally caled in the event that ReaderSoftRestart did not gave the desired results. ReaderClose: Closes readers port. This enables access to the reader from other processes. ReaderKeyWrite: Sets the keys for authentication to the reader when reading and manipulating data on the cards. The keys are entered in a special readers area in EEPROM that can not be read anymore which provided protection against unauthorized access.
ReaderUISignal: The function is used to control the reader light and sound signal. There are four modes of light signals and five sound modes.
|
|
By type of data they work with, the functions are classified in:
According to the card data addressing method, this function are divided into:
Functions for cards data manipulating are sorted according to the authentication method into the function sets recognizable by the suffix of the authentication method:
|
|
General functions for working with cards GetCardId: This function returns the type identifier and card serial number placed into the reader. Reader supports only cards that have 4 byte serial number (UID size: single) according to the standard ISO / IEC 14443 A. Functions that emulate the linear address space
These functions are used for card data reading by using the linear address space emulation. The method for proving authenticity is determined by the suffix in the functions names:
These functions are for writing data to the card using the emulation of linear address space. The method for proving authenticity is determined by the suffix in the functions names:
Functions description: These functions are used for new keys A and B writing as well as access bits in the trailers of all card sectors. The setting of ninth trailers bytes is enabled (a general-purpose byte where any value can be entered). In all the card 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 the card with the same keys and access rights for all sectors. Certainly, there must always be careful about the previously set access rights (access bits) on the cards in case the changing of some keys or bits for access rights control is disabled. Greater flexibility in sector trailers initiating is offered by SectorTrailerWrite functions group :
|
|
Functions for working with data blocks
Functions description: This functions group is used for card block content reading. Always reads the entire block (16 bytes of the block). Functions use the so-called bloc addressing (the first card 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 allows reading of the sector trailers contents (its available part for reading, depending on the access rights set).
These functions work the same as BlockRead group functions and are made for card 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 card 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).
Functions description: These functions are used for data entry (16 bytes at a time) into the card blocks. Functions use the so-called bloc addressing (the first card 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 don't allow direct data enter into the sector trailers. To do so, use the special functions SectorTrailerWrite and SectorTrailerWriteUnsafe.
FORBIDEN_DIRECT_WRITE_IN_SECTOR_TRAILER.
Function description: These functions work the same as BlockWrite group functions, they are used for data entry (16 bytes at a time) into card 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 card 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 don't allow direct data enter into the sector trailers. To do so, use the special functions SectorTrailerWrite and SectorTrailerWriteUnsafe
FORBIDEN_DIRECT_WRITE_IN_SECTOR_TRAILER.
Functions description: These functions are used for data writing in the card 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. In the case of block addressing, the first card 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 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:
*) If the access rights for the sector trailer of an appropriate sector set up so that it is possible to readB Key, it can not be used for authentication in any of the cases. These functions also sets new sector keys if it is permitted to access rights. For blocks the fallowing access rights are valid:
Functions description: 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 cards. All rules mentioned for the SectorTrailerWrite group functions applies to these functions, except the option of the "raw" data for sector trailer entry.
When using a sector address mode, then,in the case of MIFARE ® 1K card, the range can be from 0 to 15 (this card has 16 sectors) and the same card 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.
|
|
Functions for working with value blocks Value blocks represents an optional MIFARE® card functionality. This is actually a mode in which the entire block of data on the card (16 bytes) represents one four-byte value. In this mode, you can add any data block on the card (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 contains the one byte address value, which gives users the added ability to implement the backup system. D-Logic card 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 cards) 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.
Functions description: These functions are used to read the fourth byte value of value blocks. In addition they are returning the associated address stored in the value block. Functions used block addressing (the first card 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)
Functions description 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 card 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.
Functions description: 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 card 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).
Functions description: 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 card 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.
Functions description: 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 card 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).
Functions description: These functions has 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 card 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.
Functions description: 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 card 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).
Functions description: 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 card 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
|