Package org.jmrtd.lds
Class CVCAFile
- java.lang.Object
-
- org.jmrtd.lds.CVCAFile
-
- All Implemented Interfaces:
Serializable
,LDSElement
,LDSFile
public class CVCAFile extends Object
File structure for CVCA file (on EAC protected documents).- Version:
- $Revision: 1765 $
- Author:
- The JMRTD team ([email protected])
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static byte
CAR_TAG
static int
LENGTH
-
Fields inherited from interface org.jmrtd.lds.LDSFile
EF_COM_TAG, EF_DG1_TAG, EF_DG10_TAG, EF_DG11_TAG, EF_DG12_TAG, EF_DG13_TAG, EF_DG14_TAG, EF_DG15_TAG, EF_DG16_TAG, EF_DG2_TAG, EF_DG3_TAG, EF_DG4_TAG, EF_DG5_TAG, EF_DG6_TAG, EF_DG7_TAG, EF_DG8_TAG, EF_DG9_TAG, EF_SOD_TAG
-
-
Constructor Summary
Constructors Constructor Description CVCAFile(short fid, InputStream inputStream)
Constructs a new CVCA file from the data contained in an input stream.CVCAFile(short fid, String caReference)
Constructs a new CVCA file with the given certificate reference.CVCAFile(short fid, String caReference, String altCaReference)
Constructs a new CVCA file with the given certificate references.CVCAFile(InputStream inputStream)
Constructs a CVCA file by reading from a stream.CVCAFile(String caReference, String altCaReference)
Constructs a new CVCA file with default file identifier.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object other)
Tests whether this CVCAFile is equal to the provided object.CVCPrincipal
getAltCAReference()
Returns the second (alternative) CA Certificate identifier, null if none exists.CVCPrincipal
getCAReference()
Returns the CA Certificate identifier.byte[]
getEncoded()
Returns the contents of this file as byte array, includes the ICAO tag and length.short
getFID()
Gets the file identifier of this CVCA file.int
getLength()
Gets the length of the content of this CVCA file.int
hashCode()
Computes a hash code of this CVCAFile.protected void
readObject(InputStream inputStream)
Reads the file from an input stream.String
toString()
Gets a textual representation of this CVCAFile.protected void
writeObject(OutputStream outputStream)
Writes the file to an output stream.
-
-
-
Field Detail
-
CAR_TAG
public static final byte CAR_TAG
- See Also:
- Constant Field Values
-
LENGTH
public static final int LENGTH
- See Also:
- Constant Field Values
-
-
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 identifierinputStream
- 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 referencealtCaReference
- 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 identifiercaReference
- main CA certificate referencealtCaReference
- 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 identifiercaReference
- main CA certificate reference
-
-
Method Detail
-
getFID
public short getFID()
Gets 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()
Gets a textual representation of this CVCAFile.
-
equals
public boolean equals(Object other)
Tests whether this CVCAFile is equal to the provided object.
-
hashCode
public int hashCode()
Computes a hash code of this CVCAFile.
-
getLength
public int getLength()
Gets 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 interfaceLDSElement
- Returns:
- a byte array containing the file
-
-