Package org.jmrtd.lds

Class CVCAFile

    • Constructor Detail

      • CVCAFile

        public CVCAFile​(InputStream inputStream)
                 throws IOException
        Constructs a CVCA file by reading from a stream.
        Parameters:
        inputStream - the stream to read from
        Throws:
        IOException - on error reading from the stream
      • CVCAFile

        public CVCAFile​(short fid,
                        InputStream inputStream)
                 throws IOException
        Constructs a new CVCA file from the data contained in an input stream.
        Parameters:
        fid - file identifier
        inputStream - stream with the data to be parsed
        Throws:
        IOException - on error reading from input stream
      • CVCAFile

        public CVCAFile​(String caReference,
                        String altCaReference)
        Constructs a new CVCA file with default file identifier.
        Parameters:
        caReference - CA reference
        altCaReference - alternative CA reference
      • CVCAFile

        public CVCAFile​(short fid,
                        String caReference,
                        String altCaReference)
        Constructs a new CVCA file with the given certificate references.
        Parameters:
        fid - file identifier
        caReference - main CA certificate reference
        altCaReference - second (alternative) CA certificate reference
      • CVCAFile

        public CVCAFile​(short fid,
                        String caReference)
        Constructs a new CVCA file with the given certificate reference.
        Parameters:
        fid - file identifier
        caReference - main CA certificate reference
    • Method Detail

      • getFID

        public short getFID()
        Returns the file identifier of this CVCA file.
        Returns:
        the file identifier
      • readObject

        protected void readObject​(InputStream inputStream)
                           throws IOException
        Reads the file from an input stream.
        Parameters:
        inputStream - the input stream to read from
        Throws:
        IOException - if reading fails
      • writeObject

        protected void writeObject​(OutputStream outputStream)
                            throws IOException
        Writes the file to an output stream.
        Parameters:
        outputStream - the output stream to write to
        Throws:
        IOException - if writing fails
      • getCAReference

        public CVCPrincipal getCAReference()
        Returns the CA Certificate identifier.
        Returns:
        the CA Certificate identifier
      • getAltCAReference

        public CVCPrincipal getAltCAReference()
        Returns the second (alternative) CA Certificate identifier, null if none exists.
        Returns:
        the second (alternative) CA Certificate identifier
      • toString

        public String toString()
        Returns a textual representation of this CVCAFile.
        Overrides:
        toString in class Object
        Returns:
        a textual representation of this CVCAFile
      • equals

        public boolean equals​(Object other)
        Tests whether this CVCAFile is equal to the provided object.
        Overrides:
        equals in class Object
        Parameters:
        other - some other object
        Returns:
        whether this CVCAFile equals the other object
      • hashCode

        public int hashCode()
        Computes a hash code of this CVCAFile.
        Overrides:
        hashCode in class Object
        Returns:
        a hash code
      • getLength

        public int getLength()
        Returns the length of the content of this CVCA file. This always returns 36.
        Returns:
        36
      • getEncoded

        public byte[] getEncoded()
        Returns the contents of this file as byte array, includes the ICAO tag and length.
        Specified by:
        getEncoded in interface LDSElement
        Returns:
        a byte array containing the file