Package org.jmrtd.lds

Class LDSFileUtil


  • public final class LDSFileUtil
    extends Object
    Static LDS file methods.
    Version:
    $Revision: 1781 $
    Author:
    The JMRTD team ([email protected])
    • Field Detail

      • FID_TO_SFI

        public static final Map<Short,Byte> FID_TO_SFI
    • Method Detail

      • getLDSFile

        public static org.jmrtd.lds.AbstractLDSFile getLDSFile​(short fid,
                                                               InputStream inputStream)
                                                        throws IOException
        Factory method for creating LDS files for a given input stream.
        Parameters:
        fid - file identifier
        inputStream - a given input stream
        Returns:
        a specific file
        Throws:
        IOException - on reading error from the input stream
      • lookupFIDByTag

        public static short lookupFIDByTag​(int tag)
        Finds a file identifier for an ICAO tag. Corresponds to Table A1 in ICAO-TR-LDS_1.7_2004-05-18.
        Parameters:
        tag - an ICAO tag (the first byte of the EF)
        Returns:
        a file identifier.
      • lookupDataGroupNumberByTag

        public static int lookupDataGroupNumberByTag​(int tag)
        Finds a data group number for an ICAO tag.
        Parameters:
        tag - an ICAO tag (the first byte of the EF)
        Returns:
        a data group number (1-16)
      • lookupTagByDataGroupNumber

        public static int lookupTagByDataGroupNumber​(int number)
        Finds an ICAO tag for a data group number.
        Parameters:
        number - a data group number (1-16)
        Returns:
        an ICAO tag (the first byte of the EF)
      • lookupFIDByDataGroupNumber

        public static short lookupFIDByDataGroupNumber​(int number)
        Finds an ICAO tag for a data group number.
        Parameters:
        number - a data group number (1-16)
        Returns:
        a file identifier
      • lookupTagByFID

        public static short lookupTagByFID​(short fid)
        Finds an ICAO tag for a file identifier. Corresponds to Table A1 in ICAO-TR-LDS_1.7_2004-05-18.
        Parameters:
        fid - a file identifier
        Returns:
        a an ICAO tag (first byte of EF)
      • lookupDataGroupNumberByFID

        public static int lookupDataGroupNumberByFID​(short fid)
        Finds a data group number by file identifier.
        Parameters:
        fid - a file id
        Returns:
        a data group number
      • lookupFileNameByTag

        public static String lookupFileNameByTag​(int tag)
        Returns a mnemonic name corresponding to the file represented by the given ICAO tag, such as "EF_COM", "EF_SOD", or "EF_DG1".
        Parameters:
        tag - an ICAO tag (the first byte of the EF)
        Returns:
        a mnemonic name corresponding to the file represented by the given ICAO tag
      • lookupFileNameByFID

        public static String lookupFileNameByFID​(int fid)
        Returns a mnemonic name corresponding to the file represented by the given file identifier, such as "EF_COM", "EF_SOD", or "EF_DG1".
        Parameters:
        fid - an LDS file identifiers
        Returns:
        a mnemonic name corresponding to the file represented by the given ICAO tag
      • lookupSFIByFID

        public static int lookupSFIByFID​(short fid)
        Returns the short (one byte) file identifier corresponding to the given (two byte) file identifier.
        Parameters:
        fid - a file identifier
        Returns:
        the corresponding short file identifier
      • lookupFIDBySFI

        public static short lookupFIDBySFI​(byte sfi)
        Looks up a file identifier for a given short file identifier.
        Parameters:
        sfi - the short file identifier
        Returns:
        a file identifier
      • getDataGroupNumbers

        public static List<Integer> getDataGroupNumbers​(SODFile sodFile)
        Returns the data group list from the security object (SOd).
        Parameters:
        sodFile - the security object
        Returns:
        the list of data group numbers
      • getDataGroupNumbers

        public static List<Integer> getDataGroupNumbers​(COMFile comFile)
        Returns the data group list from the document index file (COM).
        Parameters:
        comFile - the document index file
        Returns:
        the list with data group number according to the document index file