Package org.jmrtd

Class BACKey

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected BACKey()
      Creates an empty BAC key entry.
        BACKey​(java.lang.String documentNumber, java.lang.String dateOfBirth, java.lang.String dateOfExpiry)
      Creates a BAC key.
        BACKey​(java.lang.String documentNumber, java.util.Date dateOfBirth, java.util.Date dateOfExpiry)
      Creates a BAC key.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)
      Tests equality of this BAC key with respect to another object.
      java.lang.String getAlgorithm()
      The algorithm of this key specification.
      java.lang.String getDateOfBirth()
      Returns the date of birth string.
      java.lang.String getDateOfExpiry()
      Returns the date of expiry string.
      java.lang.String getDocumentNumber()
      Returns the document number string.
      byte[] getKey()
      Returns the encoded key (key seed) for use in key derivation.
      int hashCode()
      Computes the hash code of this BAC key.
      protected void setDateOfBirth​(java.lang.String dateOfBirth)
      Sets the date of birth.
      protected void setDateOfExpiry​(java.lang.String dateOfExpiry)
      Sets the date of expiry.
      protected void setDocumentNumber​(java.lang.String documentNumber)
      Sets the document number.
      java.lang.String toString()
      Returns a textual representation of this BAC key.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • BACKey

        protected BACKey()
        Creates an empty BAC key entry.
      • BACKey

        public BACKey​(java.lang.String documentNumber,
                      java.util.Date dateOfBirth,
                      java.util.Date dateOfExpiry)
        Creates a BAC key.
        Parameters:
        documentNumber - the document number string, withou check digit, cannot be null, and may be shorter than 9
        dateOfBirth - the date of birth, in yymmdd format, cannot be null
        dateOfExpiry - the date of expiry, in yymmdd format, cannot be null
      • BACKey

        public BACKey​(java.lang.String documentNumber,
                      java.lang.String dateOfBirth,
                      java.lang.String dateOfExpiry)
        Creates a BAC key.
        Parameters:
        documentNumber - the document number string, cannot be null
        dateOfBirth - the date of birth string in yymmdd format, cannot be null
        dateOfExpiry - the date of expiry string in yymmdd format, cannot be null
    • Method Detail

      • getDocumentNumber

        public java.lang.String getDocumentNumber()
        Returns the document number string.
        Specified by:
        getDocumentNumber in interface BACKeySpec
        Returns:
        the document number string
      • getDateOfBirth

        public java.lang.String getDateOfBirth()
        Returns the date of birth string.
        Specified by:
        getDateOfBirth in interface BACKeySpec
        Returns:
        a date in yymmdd format
      • getDateOfExpiry

        public java.lang.String getDateOfExpiry()
        Returns the date of expiry string.
        Specified by:
        getDateOfExpiry in interface BACKeySpec
        Returns:
        a date in yymmdd format
      • toString

        public java.lang.String toString()
        Returns a textual representation of this BAC key.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a textual representation of this BAC key
      • hashCode

        public int hashCode()
        Computes the hash code of this BAC key. Document number, date of birth, and date of expiry (with year in yy precision) are taken into account.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        a hash code
      • equals

        public boolean equals​(java.lang.Object o)
        Tests equality of this BAC key with respect to another object.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        o - another object
        Returns:
        whether this BAC key equals another object
      • getAlgorithm

        public java.lang.String getAlgorithm()
        The algorithm of this key specification.
        Specified by:
        getAlgorithm in interface AccessKeySpec
        Returns:
        constant "BAC"
      • getKey

        public byte[] getKey()
        Returns the encoded key (key seed) for use in key derivation.
        Specified by:
        getKey in interface AccessKeySpec
        Returns:
        the encoded key
      • setDocumentNumber

        protected void setDocumentNumber​(java.lang.String documentNumber)
        Sets the document number.
        Parameters:
        documentNumber - the document number to set
      • setDateOfBirth

        protected void setDateOfBirth​(java.lang.String dateOfBirth)
        Sets the date of birth.
        Parameters:
        dateOfBirth - the date of birth to set
      • setDateOfExpiry

        protected void setDateOfExpiry​(java.lang.String dateOfExpiry)
        Sets the date of expiry.
        Parameters:
        dateOfExpiry - the date of expiry to set