Package eu.europa.esig.dss.model
Class DigestDocument
java.lang.Object
eu.europa.esig.dss.model.CommonDocument
eu.europa.esig.dss.model.DigestDocument
- All Implemented Interfaces:
DSSDocument,Serializable
Digest representation of a
DSSDocument. It can be used to handle a large file to be signed. The computation
of the digest associated to the file can be done externally.- See Also:
-
Field Summary
Fields inherited from class eu.europa.esig.dss.model.CommonDocument
digestMap, mimeType, name -
Constructor Summary
ConstructorsConstructorDescriptionCreates DigestDocument with an empty digest map.DigestDocument(DigestAlgorithm digestAlgorithm, byte[] digestValue) Creates DigestDocument with a digest provided in a form of byte arrayDigestDocument(DigestAlgorithm digestAlgorithm, byte[] digestValue, String name) Creates DigestDocument with a digest provided in a form of byte array with a specified document nameDigestDocument(DigestAlgorithm digestAlgorithm, String base64EncodeDigest) Creates DigestDocument with a digest provided in a form of base64-encoded StringDigestDocument(DigestAlgorithm digestAlgorithm, String base64EncodeDigest, String name) Creates DigestDocument with a digest provided in a form of base64-encoded String with a specified document nameDigestDocument(Digest digest) Creates DigestDocument with an initialDigestDigestDocument(Digest digest, String name) Creates DigestDocument with an initialDigestand a specified documentname -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDigest(DigestAlgorithm digestAlgorithm, byte[] digestValue) This method allows to add a pair:DigestAlgorithmand the corresponding digest value calculated externally on the encapsulated file.voidaddDigest(DigestAlgorithm digestAlgorithm, String base64EncodeDigest) This method allows to add a pair:DigestAlgorithmand the corresponding digest value calculated externally on the encapsulated file.voidThis method allows to add aDigestwith a new digest algorithm to the current DigestDocument.byte[]getDigestValue(DigestAlgorithm digestAlgorithm) This method returns digest value of the current document's content using the provideddigestAlgorithmGets the defined digest value for the DigestDocumentOpens aInputStreamon theDSSDocumentcontents.voidSave the content of the DSSDocument to the file.Methods inherited from class eu.europa.esig.dss.model.CommonDocument
getDigest, getMimeType, getName, setMimeType, setName, toString, writeTo
-
Constructor Details
-
DigestDocument
public DigestDocument()Creates DigestDocument with an empty digest map. Initial algorithm and digest must be specified in order to use the object -
DigestDocument
Creates DigestDocument with an initialDigest- Parameters:
digest-Digestfor the new DigestDocument
-
DigestDocument
-
DigestDocument
Creates DigestDocument with a digest provided in a form of byte array- Parameters:
digestAlgorithm-DigestAlgorithmdigestValue- byte array representing the corresponding digest value
-
DigestDocument
Creates DigestDocument with a digest provided in a form of base64-encoded String- Parameters:
digestAlgorithm-DigestAlgorithmbase64EncodeDigest- the corresponding base 64 encoded digest value
-
DigestDocument
Creates DigestDocument with a digest provided in a form of byte array with a specified document name- Parameters:
digestAlgorithm-DigestAlgorithmdigestValue- byte array representing the corresponding digest valuename- the name of the document
-
DigestDocument
Creates DigestDocument with a digest provided in a form of base64-encoded String with a specified document name- Parameters:
digestAlgorithm-DigestAlgorithmbase64EncodeDigest- the corresponding base 64 encoded digest valuename- the name of the document
-
-
Method Details
-
addDigest
-
addDigest
This method allows to add a pair:DigestAlgorithmand the corresponding digest value calculated externally on the encapsulated file.- Parameters:
digestAlgorithm-DigestAlgorithmused ot compute the digest valuedigestValue- byte array representing the corresponding digest value
-
addDigest
This method allows to add a pair:DigestAlgorithmand the corresponding digest value calculated externally on the encapsulated file. The digest value is base 64 encoded.- Parameters:
digestAlgorithm-DigestAlgorithmbase64EncodeDigest- the corresponding base 64 encoded digest value
-
getDigestValue
Description copied from interface:DSSDocumentThis method returns digest value of the current document's content using the provideddigestAlgorithm- Specified by:
getDigestValuein interfaceDSSDocument- Overrides:
getDigestValuein classCommonDocument- Parameters:
digestAlgorithm-DigestAlgorithmto get digest for- Returns:
- byte array representing digest of the document
-
getExistingDigest
-
openStream
Description copied from interface:DSSDocumentOpens aInputStreamon theDSSDocumentcontents. The type of theInputStreamdepends on the type of theDSSDocument.- Returns:
- an
InputStream
-
save
Description copied from interface:DSSDocumentSave the content of the DSSDocument to the file.- Specified by:
savein interfaceDSSDocument- Overrides:
savein classCommonDocument- Parameters:
filePath- the path to the file to be created- Throws:
IOException- if any IO error happens
-