Package org.jmrtd.lds
Class CardSecurityFile
- java.lang.Object
-
- org.jmrtd.lds.CardSecurityFile
-
- All Implemented Interfaces:
java.io.Serializable
public class CardSecurityFile extends java.lang.Object implements java.io.Serializable
Card security file stores a set of SecurityInfos for PACE with Chip Authentication Mapping (CAM).- Since:
- 0.5.6
- Version:
- $Revision: 1827 $
- Author:
- The JMRTD team ([email protected])
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CardSecurityFile(java.io.InputStream inputStream)
Constructs a new file from the data in an input stream.CardSecurityFile(java.lang.String digestAlgorithm, java.lang.String digestEncryptionAlgorithm, java.util.Collection<SecurityInfo> securityInfos, byte[] encryptedDigest, java.security.cert.X509Certificate certificate)
Constructs a new file from the provided data.CardSecurityFile(java.lang.String digestAlgorithm, java.lang.String digestEncryptionAlgorithm, java.util.Collection<SecurityInfo> securityInfos, java.security.PrivateKey privateKey, java.security.cert.X509Certificate certificate)
Constructs a new file from the provided data.CardSecurityFile(java.lang.String digestAlgorithm, java.lang.String digestEncryptionAlgorithm, java.util.Collection<SecurityInfo> securityInfos, java.security.PrivateKey privateKey, java.security.cert.X509Certificate certificate, java.lang.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(java.lang.Object otherObj)
Tests equality with respect to another object.java.util.Collection<ChipAuthenticationInfo>
getChipAuthenticationInfos()
Deprecated.Use filter utility functions inSignedDataUtil
instead.java.util.Collection<ChipAuthenticationPublicKeyInfo>
getChipAuthenticationPublicKeyInfos()
Deprecated.Use filter utility functions inSignedDataUtil
instead.java.lang.String
getDigestAlgorithm()
Returns the digest algorithm.java.lang.String
getDigestEncryptionAlgorithm()
Returns the signature algorithm.byte[]
getEncoded()
Returns a DER encoded of this file.byte[]
getEncryptedDigest()
Returns the encrypted digest (signature bytes).java.util.Collection<PACEInfo>
getPACEInfos()
Deprecated.Use filter utility functions inSignedDataUtil
instead.java.util.Collection<SecurityInfo>
getSecurityInfos()
Returns the security infos as an unordered collection.int
hashCode()
Returns a hash code of this object.protected void
readContent(java.io.InputStream inputStream)
Reads the contents of this file from a stream.java.lang.String
toString()
Returns the signature algorithm object identifier.protected void
writeContent(java.io.OutputStream outputStream)
Writes the contents of this file to a stream.
-
-
-
Constructor Detail
-
CardSecurityFile
public CardSecurityFile(java.lang.String digestAlgorithm, java.lang.String digestEncryptionAlgorithm, java.util.Collection<SecurityInfo> securityInfos, java.security.PrivateKey privateKey, java.security.cert.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(java.lang.String digestAlgorithm, java.lang.String digestEncryptionAlgorithm, java.util.Collection<SecurityInfo> securityInfos, java.security.PrivateKey privateKey, java.security.cert.X509Certificate certificate, java.lang.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(java.lang.String digestAlgorithm, java.lang.String digestEncryptionAlgorithm, java.util.Collection<SecurityInfo> securityInfos, byte[] encryptedDigest, java.security.cert.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(java.io.InputStream inputStream) throws java.io.IOException
Constructs a new file from the data in an input stream.- Parameters:
inputStream
- the input stream to parse the data from- Throws:
java.io.IOException
- on error reading input stream
-
-
Method Detail
-
getDigestAlgorithm
public java.lang.String getDigestAlgorithm()
Returns the digest algorithm.- Returns:
- the digest algorithm
-
getDigestEncryptionAlgorithm
public java.lang.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(java.io.InputStream inputStream) throws java.io.IOException
Reads the contents of this file from a stream.- Parameters:
inputStream
- the stream to read from- Throws:
java.io.IOException
- on error reading from the stream
-
writeContent
protected void writeContent(java.io.OutputStream outputStream) throws java.io.IOException
Writes the contents of this file to a stream.- Parameters:
outputStream
- the stream to write to- Throws:
java.io.IOException
- on error writing to the stream
-
getEncoded
public byte[] getEncoded()
Returns a DER encoded of this file.- Returns:
- the encoded file
-
getSecurityInfos
public java.util.Collection<SecurityInfo> getSecurityInfos()
Returns the security infos as an unordered collection.- Returns:
- security infos
-
getPACEInfos
@Deprecated public java.util.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 java.util.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 java.util.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 java.lang.String toString()
Returns the signature algorithm object identifier.- Overrides:
toString
in classjava.lang.Object
- Returns:
- signature algorithm OID
-
equals
public boolean equals(java.lang.Object otherObj)
Tests equality with respect to another object.- Overrides:
equals
in classjava.lang.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 classjava.lang.Object
- Returns:
- the hash code
-
-