Package org.jmrtd.lds
Class CardSecurityFile
- java.lang.Object
-
- org.jmrtd.lds.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 Summary
Constructors Constructor Description CardSecurityFile(InputStream inputStream)
Constructs a new file from the data in an input stream.CardSecurityFile(String digestAlgorithm, String digestEncryptionAlgorithm, Collection<SecurityInfo> securityInfos, byte[] encryptedDigest, X509Certificate certificate)
Constructs a new file from the provided data.CardSecurityFile(String digestAlgorithm, String digestEncryptionAlgorithm, Collection<SecurityInfo> securityInfos, PrivateKey privateKey, X509Certificate certificate)
Constructs a new file from the provided data.CardSecurityFile(String digestAlgorithm, String digestEncryptionAlgorithm, Collection<SecurityInfo> securityInfos, PrivateKey privateKey, X509Certificate certificate, String provider)
Constructs a new file from the provided data.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
equals(Object otherObj)
Tests equality with respect to another object.Collection<ChipAuthenticationInfo>
getChipAuthenticationInfos()
Deprecated.Use filter utility functions inSignedDataUtil
instead.Collection<ChipAuthenticationPublicKeyInfo>
getChipAuthenticationPublicKeyInfos()
Deprecated.Use filter utility functions inSignedDataUtil
instead.String
getDigestAlgorithm()
Returns the digest algorithm.String
getDigestEncryptionAlgorithm()
Returns the signature algorithm.byte[]
getEncoded()
Returns a DER encoded of this file.byte[]
getEncryptedDigest()
Returns the encrypted digest (signature bytes).Collection<PACEInfo>
getPACEInfos()
Deprecated.Use filter utility functions inSignedDataUtil
instead.Collection<SecurityInfo>
getSecurityInfos()
Returns the security infos as an unordered collection.int
hashCode()
Returns a hash code of this object.protected void
readContent(InputStream inputStream)
Reads the contents of this file from a stream.String
toString()
Returns the signature algorithm object identifier.protected void
writeContent(OutputStream outputStream)
Writes the contents of this file to a stream.
-
-
-
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 mnemonicdigestEncryptionAlgorithm
- the signature algorithm as Java mnemonicsecurityInfos
- a non-empty list of security infosprivateKey
- the private signing keycertificate
- 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 mnemonicdigestEncryptionAlgorithm
- the signature algorithm as Java mnemonicsecurityInfos
- a non-empty list of security infosprivateKey
- the private signing keycertificate
- the certificate to embed, which should correspond to the given private keyprovider
- 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 mnemonicdigestEncryptionAlgorithm
- the signature algorithm as Java mnemonicsecurityInfos
- a non-empty list of security infosencryptedDigest
- the signaturecertificate
- 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 inSignedDataUtil
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 inSignedDataUtil
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 inSignedDataUtil
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.
-
equals
public boolean equals(Object otherObj)
Tests equality with respect to another object.
-
-