Send UID or block data from a card/tag over Wiegand

Card/tag data can be passed straight to an access controller by your VTAP reader, like data from any other card reader. The most simple scenario is where the data required is the card/tag UID. Your config.txt file will need to contain settings like those used in this example:

When TagWiegandBits=0, the Wiegand bit length will be determined from the number of bytes of data that have been read. We recommend this automatic method where you have a mixed population of cards: For example a MIFARE Classic UID could be either 4 bytes or 7 bytes and will then produce 32 bit or 56 bit Wiegand data appropriately.

Setting a specific bit length value will cause a larger bit length UID to be truncated, or a smaller bit length UID zero-padded, to the achieve the set bit length. This may be better if your access controller only supports a small bit length data (eg 32 bit).

Additional settings are needed if you want to Read block data from MIFARE Classic card/tags or Read DESFire card/tags. And there are a number of settings which will allow you to adjust the Format of card/tag data before it is sent over the Wiegand interface.

Read block data from MIFARE Classic card/tag

If your application requires reading block data from a MIFARE Classic card/tag (MIFAREClassic=B or =3), you need to set the following additional parameters to define which block to read, and specify the key and its type, in order to read that block.

  • TagReadBlockNum specifies the block number to read. Set a value between 0 to 255 (default is TagReadBlockNum=0). MIFARE Classic 1K cards have 64 blocks; 4k cards have 256 blocks, which are numbered in decimal from 0 to 255.

  • TagReadKey is a hex value key, needed to read the block data. Set a 6-byte hexadecimal value corresponding to the key required to read the block chosen by TagReadBlockNum. There is no default for this.

    Alternatively, you can save the key needed to read the block data in a file called appkey#.txt on the VTAP reader and set TagReadKeySlot=# instead, where # is the key number, an integer from 1 to 9.

  • TagReadKeyType is the key type for the key identified in TagReadKey. Set =A or =B corresponding to the MIFARE Classic key type. Default is TagReadKeyType=A.

MIFARE block data specific settings are used in the following example:

Remember that there are a number of additional settings which will allow you to adjust the Format of card/tag data before it is sent over the Wiegand interface if needed.

Read DESFire cards or tags over Wiegand interface

Read secured data from DESFire cards or tags contains a detailed discussion on reading DESFire cards/ tags and handling the output.

DESFire specific settings are used in the following example:

If you use DESFire#Format=1 to select Key-ID 26-bit format, you need to be aware that different sections of the data serve different functions, as separate facility code and card number, which affects how that data converts from binary to decimal or hex:

Translation of 26-bit Wiegand data from binary to decimal or hex as a combination of facility code and card number

In this case, if an output was sent to an ASCII interface, such as the COMport, that output would be a concatenation of the decimal facility code and decimal card number, 05012597.

Remember that there are a number of settings which will allow you to adjust the Format of card/tag data before it is sent over the Wiegand interface. In particular, if reading DESFire cards or tags when the DESFire#Format is not set (=0), you may want to use TagWiegandASCIIFormat (in conjunction with TagReadFormat=a and DESFire#ReadLength) since the output data format and length is not otherwise constrained.

Note: When using the Wiegand interface, multiple reads are not supported. In this case, only the lowest numbered DESFire#... settings will be used, which might not be DESFire1.... If only DESFire3... and DESFire4... settings are defined in config.txt, the DESFire3... settings would then be used for output over Wiegand.

Format of card/tag data sent over Wiegand

Before UID or block data is sent to a Wiegand interface you may need to perform a number of operations on that data, such as changing byte order, truncation, right shifting the bits, padding with zeroes or addition of parity bits. The settings required to perform these operations are discussed here:

Note: The Wiegand interface is only available if you are using the VTAP100‑PAC‑W model.

  • TagByteOrder will reverse the byte order of the block data or UID read from a card or tag. (Or use TagByteOrderTypes if you only want to reverse byte order for some card or tag types.)

  • TagReadFormat sets the format of the extracted binary block data as ASCII (a), hex (h), or decimal (d).

    • When TagReadFormat=a (ASCII), each byte is an ASCII character.

      This will output the binary data from card/tag as an ASCII character sequence over ASCII interfaces (COM, Serial, Serial2, keyboard emulation). Use this setting along with TagWiegandASCIIFormat if the tag data is an ASCII sequence representing the digits of a decimal or hexadecimal value. If TagReadFormat is not set =a, binary data will be output to the Wiegand interface.

    • TagReadFormat=d will interpret the binary data as 64 bit decimal value for output to ASCII interfaces.

      If the tag data is a binary sequence (not an ASCII sequence) then use TagReadFormat=d or =h along with any other settings required to adjust the binary data for output over Wiegand.

    • TagReadFormat=h (default) converts the binary data to hex digits with 2 digits per byte for output to ASCII interfaces.

  • TagWiegandASCIIFormat sets how to interpret tag data that contains an ASCII character sequence, representing a decimal or hexadecimal number, for output as a bit sequence over Wiegand. This setting only works when TagReadFormat=a.

    • Set TagWiegandASCIIFormat=a (default) to send the ASCII character byte values directly as a sequence of bits over Wiegand.

    • TagWiegandASCIIFormat=d to interpret the ASCII character sequence as a decimal number (up to 64 bits) when converting to a Wiegand bit sequence.

    • TagWiegandASCIIFormat=h to interpret the ASCII character sequence as a hexadecimal number when converting to a Wiegand bit sequence.

  • TagWiegandBits=56 lets you specify the number of bits (1 to 255) to output over the Wiegand interface, from the start of the extracted tag data. If omitted it defaults to 0, meaning that the Wiegand bit length is automatic: The number of bits is determined automatically from the number of bytes of tag data that have been read.

  • TagWiegandParity=1 adds a single 'parity bit' equivalent to the resulting bit sequence that is sent over Wiegand. This makes it possible to use tag or card data formats that include parity bits. Parity bit equivalents can be used if the parity bit(s) are not being tested for validity. TagWiegandParity=2 adds calculated odd and even parity bits to the data. Either can be used with TagReadFormat=a and TagWiegandASCIIFormat=d or =h to get decimal or hex data. Again, the default =0 turns this feature off.

  • TagReadOffset sets a byte offset within the block or UID data to start reading from, using a value between 1 to 15. This setting is often used with TagReadLength to specify starting point of the desired data to be extracted and how many bytes to read from that starting point. If using TagReadOffset along with TagReadLength, the TagReadOffset + TagReadLength values must be less than or equal to 16, otherwise the length will be reduced by truncating data. Default TagReadOffset=0 (no offset).

    Note: TagReadOffset and TagReadLength are not applicable when reading secure DESFire data where DESFireReadLength is used instead.

  • TagReadRightShift will right shift decimal 64bit data. It can be used to remove any parity bits at the end of extracted binary data. Use a value from 1 to 63 to enable this setting, with a default is TagReadRightShift=0. TagReadFormat must be set to decimal (=d).

The following example shows how using TagByteOrder will change the UID card/tag data output from a VTAP reader over all interfaces.

If you only want to reverse the byte order on certain types of card/tag data, refer to NFC card or tag settings for more about the alternative TagByteOrderTypes.

The following example shows how using the card/tag data format settings can progressively change the way MIFARE Classic block data is output from a VTAP reader over all interfaces.

The following example shows how using the card/tag data format settings can change the way secure DESFire data is output from a VTAP reader over all interfaces.