java.lang.Object
dev.hloth.zgztransport.Uid
The UID of block 0, four or seven bytes, together with the chip whose SAK and
ATQA sit beside it. The length belongs to the block rather than to the chip:
a 4K card comes with either.
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]bytes()The bytes of this UID.chip()The chip this UID was read beside.static Uiddecode(byte[] block) Decodes block 0 by trying the two layouts a block 0 comes in, the seven byte one first, and reading the chip off the SAK and the ATQA each of them puts after the UID.booleaninthashCode()static UidThe UID those bytes hold, on the chip it was read from.toString()The UID as upper case hex, the form dump tools print.
-
Method Details
-
of
The UID those bytes hold, on the chip it was read from.- Parameters:
bytes- the UID bytes, four or seven of them, which are copiedchip- the chip the card is built on- Returns:
- the UID
- Throws:
CardFormatException- if the UID is neither four nor seven bytes longNullPointerException- if the chip is null
-
decode
Decodes block 0 by trying the two layouts a block 0 comes in, the seven byte one first, and reading the chip off the SAK and the ATQA each of them puts after the UID. A seven byte UID can hold a known SAK in byte 5 by chance, so the BCC and the ATQA position are what tell the two apart.- Parameters:
block- the sixteen bytes- Returns:
- the UID and the chip it was read beside
- Throws:
CardFormatException- if the block is not sixteen bytes, or neither layout holds a known SAK and ATQA with a matching BCC
-
bytes
public byte[] bytes()The bytes of this UID.- Returns:
- a copy of them
-
chip
The chip this UID was read beside.- Returns:
- the chip
-
equals
-
hashCode
public int hashCode() -
toString
The UID as upper case hex, the form dump tools print.
-