public class SODFile extends DataGroup
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 and Description |
---|
SODFile(java.io.InputStream inputStream)
Constructs a Security Object data structure.
|
SODFile(java.lang.String digestAlgorithm,
java.lang.String digestEncryptionAlgorithm,
java.util.Map<java.lang.Integer,byte[]> dataGroupHashes,
byte[] encryptedDigest,
java.security.cert.X509Certificate docSigningCertificate)
Constructs a Security Object data structure.
|
SODFile(java.lang.String digestAlgorithm,
java.lang.String digestEncryptionAlgorithm,
java.util.Map<java.lang.Integer,byte[]> dataGroupHashes,
java.security.PrivateKey privateKey,
java.security.cert.X509Certificate docSigningCertificate)
Constructs a Security Object data structure.
|
SODFile(java.lang.String digestAlgorithm,
java.lang.String digestEncryptionAlgorithm,
java.util.Map<java.lang.Integer,byte[]> dataGroupHashes,
java.security.PrivateKey privateKey,
java.security.cert.X509Certificate docSigningCertificate,
java.lang.String provider)
Constructs a Security Object data structure using a specified signature provider.
|
SODFile(java.lang.String digestAlgorithm,
java.lang.String digestEncryptionAlgorithm,
java.util.Map<java.lang.Integer,byte[]> dataGroupHashes,
java.security.PrivateKey privateKey,
java.security.cert.X509Certificate docSigningCertificate,
java.lang.String provider,
java.lang.String ldsVersion,
java.lang.String unicodeVersion)
Constructs a Security Object data structure using a specified signature provider.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkDocSignature(java.security.cert.Certificate docSigningCert)
Verifies the signature over the contents of the security object.
|
boolean |
equals(java.lang.Object obj) |
java.util.Map<java.lang.Integer,byte[]> |
getDataGroupHashes()
Gets the stored data group hashes.
|
java.lang.String |
getDigestAlgorithm()
Gets the name of the algorithm used in the data group hashes.
|
java.lang.String |
getDigestEncryptionAlgorithm()
Gets the name of the digest encryption algorithm used in the signature.
|
java.security.cert.X509Certificate |
getDocSigningCertificate()
Gets the embedded document signing certificate (if present).
|
byte[] |
getEContent()
Gets the e-content inside the signed data strucure.
|
byte[] |
getEncoded()
Gets the contents of this file as byte array,
includes the ICAO tag and length.
|
byte[] |
getEncryptedDigest()
Gets the signature (the encrypted digest) over the hashes.
|
javax.security.auth.x500.X500Principal |
getIssuerX500Principal()
Gets the issuer of the document signing certificate.
|
java.lang.String |
getLDSVersion()
Gets the version of the LDS if stored in the Security Object (SOd).
|
java.math.BigInteger |
getSerialNumber()
Gets the serial number of the document signing certificate.
|
java.lang.String |
getSignerInfoDigestAlgorithm()
Gets the name of the digest algorithm used in the signature.
|
java.lang.String |
getUnicodeVersion()
Gets the version of unicode if stored in the Security Object (SOd).
|
int |
hashCode() |
protected void |
readContent(java.io.InputStream inputStream)
Reads the contents of the data group from an input stream.
|
java.lang.String |
toString()
Gets a textual representation of this file.
|
protected void |
writeContent(java.io.OutputStream out)
Writes the contents of the data group to an output stream.
|
getLength, getTag, readObject, writeObject
public SODFile(java.lang.String digestAlgorithm, java.lang.String digestEncryptionAlgorithm, java.util.Map<java.lang.Integer,byte[]> dataGroupHashes, byte[] encryptedDigest, java.security.cert.X509Certificate docSigningCertificate) throws java.security.NoSuchAlgorithmException, java.security.cert.CertificateException
digestAlgorithm
- a digest algorithm, such as "SHA-1" or "SHA-256"digestEncryptionAlgorithm
- a digest encryption algorithm, such as "SHA256withRSA"dataGroupHashes
- maps datagroup numbers (1 to 16) to hashes of the data groupsencryptedDigest
- ???docSigningCertificate
- the document signing certificatejava.security.NoSuchAlgorithmException
- if either of the algorithm parameters is not recognizedjava.security.cert.CertificateException
- if the document signing certificate cannot be usedpublic SODFile(java.lang.String digestAlgorithm, java.lang.String digestEncryptionAlgorithm, java.util.Map<java.lang.Integer,byte[]> dataGroupHashes, java.security.PrivateKey privateKey, java.security.cert.X509Certificate docSigningCertificate, java.lang.String provider) throws java.security.NoSuchAlgorithmException, java.security.cert.CertificateException
digestAlgorithm
- a digest algorithm, such as "SHA-1" or "SHA-256"digestEncryptionAlgorithm
- a digest encryption algorithm, such as "SHA256withRSA"dataGroupHashes
- maps datagroup numbers (1 to 16) to hashes of the data groupsprivateKey
- private key to sign the datadocSigningCertificate
- the document signing certificateprovider
- specific signature provider that should be used to create the signaturejava.security.NoSuchAlgorithmException
- if either of the algorithm parameters is not recognizedjava.security.cert.CertificateException
- if the document signing certificate cannot be usedpublic SODFile(java.lang.String digestAlgorithm, java.lang.String digestEncryptionAlgorithm, java.util.Map<java.lang.Integer,byte[]> dataGroupHashes, java.security.PrivateKey privateKey, java.security.cert.X509Certificate docSigningCertificate, java.lang.String provider, java.lang.String ldsVersion, java.lang.String unicodeVersion) throws java.security.NoSuchAlgorithmException, java.security.cert.CertificateException
digestAlgorithm
- a digest algorithm, such as "SHA-1" or "SHA-256"digestEncryptionAlgorithm
- a digest encryption algorithm, such as "SHA256withRSA"dataGroupHashes
- maps datagroup numbers (1 to 16) to hashes of the data groupsprivateKey
- private key to sign the datadocSigningCertificate
- the document signing certificateprovider
- specific signature provider that should be used to create the signatureldsVersion
- LDS versionunicodeVersion
- Unicode versionjava.security.NoSuchAlgorithmException
- if either of the algorithm parameters is not recognizedjava.security.cert.CertificateException
- if the document signing certificate cannot be usedpublic SODFile(java.lang.String digestAlgorithm, java.lang.String digestEncryptionAlgorithm, java.util.Map<java.lang.Integer,byte[]> dataGroupHashes, java.security.PrivateKey privateKey, java.security.cert.X509Certificate docSigningCertificate) throws java.security.NoSuchAlgorithmException, java.security.cert.CertificateException
digestAlgorithm
- a digest algorithm, such as "SHA1" or "SHA256"digestEncryptionAlgorithm
- a digest encryption algorithm, such as "SHA256withRSA"dataGroupHashes
- maps datagroup numbers (1 to 16) to hashes of the data groupsprivateKey
- private key to sign the datadocSigningCertificate
- the document signing certificatejava.security.NoSuchAlgorithmException
- if either of the algorithm parameters is not recognizedjava.security.cert.CertificateException
- if the document signing certificate cannot be usedpublic SODFile(java.io.InputStream inputStream) throws java.io.IOException
inputStream
- some inputstreamjava.io.IOException
- if something goes wrongprotected void readContent(java.io.InputStream inputStream) throws java.io.IOException
DataGroup
readContent
in class DataGroup
inputStream
- the input stream to read fromjava.io.IOException
- on error reading from input streamprotected void writeContent(java.io.OutputStream out) throws java.io.IOException
DataGroup
writeContent
in class DataGroup
out
- the output stream to write tojava.io.IOException
- on error writing to output streampublic java.util.Map<java.lang.Integer,byte[]> getDataGroupHashes()
public byte[] getEncryptedDigest()
public byte[] getEContent()
public java.lang.String getDigestAlgorithm()
public java.lang.String getSignerInfoDigestAlgorithm()
public java.lang.String getDigestEncryptionAlgorithm()
public java.lang.String getLDSVersion()
public java.lang.String getUnicodeVersion()
public java.security.cert.X509Certificate getDocSigningCertificate() throws java.security.cert.CertificateException
java.security.cert.CertificateException
- when certificate not be constructed from this SOdpublic boolean checkDocSignature(java.security.cert.Certificate docSigningCert) throws java.security.GeneralSecurityException
docSigningCert
- the certificate to use
(should be X509 certificate)java.security.GeneralSecurityException
- if something goes wrongpublic javax.security.auth.x500.X500Principal getIssuerX500Principal()
public java.math.BigInteger getSerialNumber()
public java.lang.String toString()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public byte[] getEncoded()
getEncoded
in interface LDSElement