Package org.jmrtd
Class BACKey
- java.lang.Object
-
- org.jmrtd.BACKey
-
- All Implemented Interfaces:
java.io.Serializable
,java.security.spec.KeySpec
,AccessKeySpec
,BACKeySpec
public class BACKey extends java.lang.Object implements BACKeySpec
A BAC key.- Version:
- $Revision: 1808 $
- Author:
- The JMRTD team ([email protected])
- See Also:
- Serialized Form
-
-
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.
-
-
-
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 benull
, and may be shorter than 9dateOfBirth
- the date of birth, in yymmdd format, cannot benull
dateOfExpiry
- the date of expiry, in yymmdd format, cannot benull
-
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 benull
dateOfBirth
- the date of birth string in yymmdd format, cannot benull
dateOfExpiry
- the date of expiry string in yymmdd format, cannot benull
-
-
Method Detail
-
getDocumentNumber
public java.lang.String getDocumentNumber()
Returns the document number string.- Specified by:
getDocumentNumber
in interfaceBACKeySpec
- Returns:
- the document number string
-
getDateOfBirth
public java.lang.String getDateOfBirth()
Returns the date of birth string.- Specified by:
getDateOfBirth
in interfaceBACKeySpec
- Returns:
- a date in yymmdd format
-
getDateOfExpiry
public java.lang.String getDateOfExpiry()
Returns the date of expiry string.- Specified by:
getDateOfExpiry
in interfaceBACKeySpec
- Returns:
- a date in yymmdd format
-
toString
public java.lang.String toString()
Returns a textual representation of this BAC key.- Overrides:
toString
in classjava.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 classjava.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 classjava.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 interfaceAccessKeySpec
- Returns:
- constant "BAC"
-
getKey
public byte[] getKey()
Returns the encoded key (key seed) for use in key derivation.- Specified by:
getKey
in interfaceAccessKeySpec
- 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
-
-