public class SODFile extends AbstractTaggedLDSFile
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(InputStream inputStream)
Constructs a Security Object data structure.
|
SODFile(String digestAlgorithm,
String digestEncryptionAlgorithm,
Map<Integer,byte[]> dataGroupHashes,
byte[] encryptedDigest,
X509Certificate docSigningCertificate)
Constructs a Security Object data structure.
|
SODFile(String digestAlgorithm,
String digestEncryptionAlgorithm,
Map<Integer,byte[]> dataGroupHashes,
PrivateKey privateKey,
X509Certificate docSigningCertificate)
Constructs a Security Object data structure.
|
SODFile(String digestAlgorithm,
String digestEncryptionAlgorithm,
Map<Integer,byte[]> dataGroupHashes,
PrivateKey privateKey,
X509Certificate docSigningCertificate,
String provider)
Constructs a Security Object data structure using a specified signature provider.
|
SODFile(String digestAlgorithm,
String digestEncryptionAlgorithm,
Map<Integer,byte[]> dataGroupHashes,
PrivateKey privateKey,
X509Certificate docSigningCertificate,
String provider,
String ldsVersion,
String unicodeVersion)
Constructs a Security Object data structure using a specified signature provider.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkDocSignature(Certificate docSigningCert)
Deprecated.
this method will be moved, LDS data objects should not be responsible for verification
|
boolean |
equals(Object obj) |
Map<Integer,byte[]> |
getDataGroupHashes()
Gets the stored data group hashes.
|
String |
getDigestAlgorithm()
Gets the name of the algorithm used in the data group hashes.
|
String |
getDigestEncryptionAlgorithm()
Gets the name of the digest encryption algorithm used in the signature.
|
X509Certificate |
getDocSigningCertificate()
Gets the embedded document signing certificate (if present).
|
byte[] |
getEContent()
Gets the e-content inside the signed data structure.
|
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.
|
X500Principal |
getIssuerX500Principal()
Gets the issuer of the document signing certificate.
|
String |
getLDSVersion()
Gets the version of the LDS if stored in the Security Object (SOd).
|
BigInteger |
getSerialNumber()
Gets the serial number of the document signing certificate.
|
String |
getSignerInfoDigestAlgorithm()
Gets the name of the digest algorithm used in the signature.
|
String |
getUnicodeVersion()
Gets the version of unicode if stored in the Security Object (SOd).
|
int |
hashCode() |
protected void |
readContent(InputStream inputStream)
Reads the contents of the data group from an input stream.
|
String |
toString()
Gets a textual representation of this file.
|
protected void |
writeContent(OutputStream outputStream)
Writes the contents of the data group to an output stream.
|
getLength, getTag, readObject, writeObject
public SODFile(String digestAlgorithm, String digestEncryptionAlgorithm, Map<Integer,byte[]> dataGroupHashes, PrivateKey privateKey, X509Certificate docSigningCertificate) throws NoSuchAlgorithmException, 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 certificateNoSuchAlgorithmException
- if either of the algorithm parameters is not recognizedCertificateException
- if the document signing certificate cannot be usedpublic SODFile(String digestAlgorithm, String digestEncryptionAlgorithm, Map<Integer,byte[]> dataGroupHashes, PrivateKey privateKey, X509Certificate docSigningCertificate, String provider) throws NoSuchAlgorithmException, 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 contentsdocSigningCertificate
- the document signing certificate to embedprovider
- specific signature provider that should be used to create the signatureNoSuchAlgorithmException
- if either of the algorithm parameters is not recognizedCertificateException
- if the document signing certificate cannot be usedpublic SODFile(String digestAlgorithm, String digestEncryptionAlgorithm, Map<Integer,byte[]> dataGroupHashes, PrivateKey privateKey, X509Certificate docSigningCertificate, String provider, String ldsVersion, String unicodeVersion) throws NoSuchAlgorithmException, 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 versionNoSuchAlgorithmException
- if either of the algorithm parameters is not recognizedCertificateException
- if the document signing certificate cannot be usedpublic SODFile(String digestAlgorithm, String digestEncryptionAlgorithm, Map<Integer,byte[]> dataGroupHashes, byte[] encryptedDigest, X509Certificate docSigningCertificate) throws NoSuchAlgorithmException, 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
- externally signed contentsdocSigningCertificate
- the document signing certificateNoSuchAlgorithmException
- if either of the algorithm parameters is not recognizedCertificateException
- if the document signing certificate cannot be usedpublic SODFile(InputStream inputStream) throws IOException
inputStream
- some inputstreamIOException
- if something goes wrongprotected void readContent(InputStream inputStream) throws IOException
AbstractTaggedLDSFile
readContent
in class AbstractTaggedLDSFile
inputStream
- the input stream to read fromIOException
- on error reading from input streamprotected void writeContent(OutputStream outputStream) throws IOException
AbstractTaggedLDSFile
writeContent
in class AbstractTaggedLDSFile
outputStream
- the output stream to write toIOException
- on error writing to output streampublic Map<Integer,byte[]> getDataGroupHashes()
public byte[] getEncryptedDigest()
public byte[] getEContent()
public String getDigestAlgorithm()
public String getSignerInfoDigestAlgorithm()
public String getDigestEncryptionAlgorithm()
public String getLDSVersion()
public String getUnicodeVersion()
public X509Certificate getDocSigningCertificate() throws CertificateException
CertificateException
- when certificate not be constructed from this SOdpublic boolean checkDocSignature(Certificate docSigningCert) throws GeneralSecurityException
docSigningCert
- the certificate to use
(should be X509 certificate)GeneralSecurityException
- if something goes wrongpublic X500Principal getIssuerX500Principal()
public BigInteger getSerialNumber()
public String toString()
toString
in class AbstractTaggedLDSFile
public byte[] getEncoded()
getEncoded
in interface LDSElement
Copyright © 2016. All rights reserved.