Class KeySerialNumber

  • All Implemented Interfaces:
    java.io.Serializable, Loggeable

    public class KeySerialNumber
    extends java.lang.Object
    implements java.io.Serializable, Loggeable
    Key Serial Number (also called Key Name in the ANSI X9.24). Needed for deriving the Transaction Key when DUKPT (Derived Unique Key Per Transaction) method is used.
    Refer to ANSI X9.24 for more information about DUKPT
    See Also:
    EncryptedPIN, Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      KeySerialNumber()
      Constructs a key serial number object
      KeySerialNumber​(byte[] binKSN, int idLength, int deviceLength, int counterLength)
      Constructs a key serial number object from its binary representation.
      KeySerialNumber​(java.lang.String hexKSN, int idLength, int deviceLength, int counterLength)
      Constructs a key serial number object from its hexadecimal representation.
      KeySerialNumber​(java.lang.String baseKeyID, java.lang.String deviceID, java.lang.String transactionCounter)
      Constructs a key serial number object
    • Constructor Detail

      • KeySerialNumber

        public KeySerialNumber()
        Constructs a key serial number object
      • KeySerialNumber

        public KeySerialNumber​(java.lang.String baseKeyID,
                               java.lang.String deviceID,
                               java.lang.String transactionCounter)
        Constructs a key serial number object
        Parameters:
        baseKeyID - a HexString representing the BaseKeyID (also called KeySet ID)
        deviceID - a HexString representing the Device ID (also called TRSM ID)
        transactionCounter - a HexString representing the transaction counter
      • KeySerialNumber

        public KeySerialNumber​(java.lang.String hexKSN,
                               int idLength,
                               int deviceLength,
                               int counterLength)
        Constructs a key serial number object from its hexadecimal representation.
        Parameters:
        hexKSN - hexadecimal representation of the KSN.
        idLength - length of the base key ID.
        deviceLength - length of the device ID.
        counterLength - length of the transaction counter.
      • KeySerialNumber

        public KeySerialNumber​(byte[] binKSN,
                               int idLength,
                               int deviceLength,
                               int counterLength)
        Constructs a key serial number object from its binary representation.
        Parameters:
        binKSN - binary representation of the KSN.
        idLength - length of the base key ID.
        deviceLength - length of the device ID.
        counterLength - length of the transaction counter.
    • Method Detail

      • setBaseKeyID

        public void setBaseKeyID​(java.lang.String baseKeyID)
        Parameters:
        baseKeyID - a HexString representing the BaseKeyID (also called KeySet ID)
      • getBaseKeyID

        public java.lang.String getBaseKeyID()
        Returns:
        baseKeyID a HexString representing the BaseKeyID (also called KeySet ID)
      • setDeviceID

        public void setDeviceID​(java.lang.String deviceID)
        Parameters:
        deviceID - a HexString representing the Device ID (also called TRSM ID)
      • getDeviceID

        public java.lang.String getDeviceID()
        Returns:
        deviceID a HexString representing the Device ID (also called TRSM ID)
      • setTransactionCounter

        public void setTransactionCounter​(java.lang.String transactionCounter)
        Parameters:
        transactionCounter - a HexString representing the transaction counter
      • getTransactionCounter

        public java.lang.String getTransactionCounter()
        Returns:
        transactionCounter a HexString representing the transaction counter
      • dump

        public void dump​(java.io.PrintStream p,
                         java.lang.String indent)
        dumps Key Serial Number
        Specified by:
        dump in interface Loggeable
        Parameters:
        p - a PrintStream usually supplied by Logger
        indent - indention string, usually suppiled by Logger
        See Also:
        Loggeable