Package org.jmrtd.lds

Class CardSecurityFile

  • All Implemented Interfaces:
    Serializable

    public class CardSecurityFile
    extends Object
    implements Serializable
    Card security file stores a set of SecurityInfos for PACE with Chip Authentication Mapping (CAM).
    Since:
    0.5.6
    Version:
    $Revision: 1799 $
    Author:
    The JMRTD team ([email protected])
    See Also:
    Serialized Form
    • Constructor Detail

      • CardSecurityFile

        public CardSecurityFile​(String digestAlgorithm,
                                String digestEncryptionAlgorithm,
                                Collection<SecurityInfo> securityInfos,
                                PrivateKey privateKey,
                                X509Certificate certificate)
        Constructs a new file from the provided data.
        Parameters:
        digestAlgorithm - the digest algorithm as Java mnemonic
        digestEncryptionAlgorithm - the signature algorithm as Java mnemonic
        securityInfos - a non-empty list of security infos
        privateKey - the private signing key
        certificate - the certificate to embed, which should correspond to the given private key
      • CardSecurityFile

        public CardSecurityFile​(String digestAlgorithm,
                                String digestEncryptionAlgorithm,
                                Collection<SecurityInfo> securityInfos,
                                PrivateKey privateKey,
                                X509Certificate certificate,
                                String provider)
        Constructs a new file from the provided data.
        Parameters:
        digestAlgorithm - the digest algorithm as Java mnemonic
        digestEncryptionAlgorithm - the signature algorithm as Java mnemonic
        securityInfos - a non-empty list of security infos
        privateKey - the private signing key
        certificate - the certificate to embed, which should correspond to the given private key
        provider - the security provider to use
      • CardSecurityFile

        public CardSecurityFile​(String digestAlgorithm,
                                String digestEncryptionAlgorithm,
                                Collection<SecurityInfo> securityInfos,
                                byte[] encryptedDigest,
                                X509Certificate certificate)
        Constructs a new file from the provided data.
        Parameters:
        digestAlgorithm - the digest algorithm as Java mnemonic
        digestEncryptionAlgorithm - the signature algorithm as Java mnemonic
        securityInfos - a non-empty list of security infos
        encryptedDigest - the signature
        certificate - the certificate to embed
      • CardSecurityFile

        public CardSecurityFile​(InputStream inputStream)
                         throws IOException
        Constructs a new file from the data in an input stream.
        Parameters:
        inputStream - the input stream to parse the data from
        Throws:
        IOException - on error reading input stream
    • Method Detail

      • getDigestAlgorithm

        public String getDigestAlgorithm()
        Returns the digest algorithm.
        Returns:
        the digest algorithm
      • getDigestEncryptionAlgorithm

        public String getDigestEncryptionAlgorithm()
        Returns the signature algorithm.
        Returns:
        the signature algorithm
      • getEncryptedDigest

        public byte[] getEncryptedDigest()
        Returns the encrypted digest (signature bytes).
        Returns:
        the encrypted digest
      • readContent

        protected void readContent​(InputStream inputStream)
                            throws IOException
        Reads the contents of this file from a stream.
        Parameters:
        inputStream - the stream to read from
        Throws:
        IOException - on error reading from the stream
      • writeContent

        protected void writeContent​(OutputStream outputStream)
                             throws IOException
        Writes the contents of this file to a stream.
        Parameters:
        outputStream - the stream to write to
        Throws:
        IOException - on error writing to the stream
      • getEncoded

        public byte[] getEncoded()
        Returns a DER encoded of this file.
        Returns:
        the encoded file
      • getSecurityInfos

        public Collection<SecurityInfo> getSecurityInfos()
        Returns the security infos as an unordered collection.
        Returns:
        security infos
      • getPACEInfos

        @Deprecated
        public Collection<PACEInfo> getPACEInfos()
        Deprecated.
        Use filter utility functions in SignedDataUtil instead.
        Returns the PACE infos embedded in this card access file. If no infos are present, an empty list is returned.
        Returns:
        a list of PACE infos
      • getChipAuthenticationInfos

        @Deprecated
        public Collection<ChipAuthenticationInfo> getChipAuthenticationInfos()
        Deprecated.
        Use filter utility functions in SignedDataUtil instead.
        Returns the CA public key infos embedded in this card access file. If no infos are present, an empty list is returned.
        Returns:
        a list of CA public key infos
      • getChipAuthenticationPublicKeyInfos

        @Deprecated
        public Collection<ChipAuthenticationPublicKeyInfo> getChipAuthenticationPublicKeyInfos()
        Deprecated.
        Use filter utility functions in SignedDataUtil instead.
        Returns the CA public key infos embedded in this card access file. If no infos are present, an empty list is returned.
        Returns:
        a list of CA public key infos
      • toString

        public String toString()
        Returns the signature algorithm object identifier.
        Overrides:
        toString in class Object
        Returns:
        signature algorithm OID
      • equals

        public boolean equals​(Object otherObj)
        Tests equality with respect to another object.
        Overrides:
        equals in class Object
        Parameters:
        otherObj - another object
        Returns:
        whether this object equals the other object
      • hashCode

        public int hashCode()
        Returns a hash code of this object.
        Overrides:
        hashCode in class Object
        Returns:
        the hash code