Class Uid

java.lang.Object
dev.hloth.zgztransport.Uid

public final class Uid extends Object
The UID of block 0, whose length depends on the chip the card is built on.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    The bytes of this UID.
    The chip this UID belongs to.
    static Uid
    decode(byte[] block)
    Decodes block 0 by looking for the SAK of each known chip, in the order Chip.DETECTION_ORDER sets.
    boolean
    equals(Object other)
     
    int
     
    static Uid
    of(byte[] bytes)
    The UID those bytes hold, whose length says which chip it belongs to.
    The UID as upper case hex, the form dump tools print.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Method Details

    • of

      public static Uid of(byte[] bytes)
      The UID those bytes hold, whose length says which chip it belongs to.
      Parameters:
      bytes - the UID bytes, which are copied
      Returns:
      the UID
      Throws:
      CardFormatException - if no known chip has UIDs of that length
    • decode

      public static Uid decode(byte[] block)
      Decodes block 0 by looking for the SAK of each known chip, in the order Chip.DETECTION_ORDER sets.
      Parameters:
      block - the sixteen bytes
      Returns:
      the UID
      Throws:
      CardFormatException - if the block is not sixteen bytes or carries no known SAK
    • bytes

      public byte[] bytes()
      The bytes of this UID.
      Returns:
      a copy of them
    • chip

      public Chip chip()
      The chip this UID belongs to.
      Returns:
      the chip
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      The UID as upper case hex, the form dump tools print.
      Overrides:
      toString in class Object
      Returns:
      the printed UID