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
ConstructorDescriptionCreates 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 initialDigest
DigestDocument
(Digest digest, String name) Creates DigestDocument with an initialDigest
and a specified documentname
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addDigest
(DigestAlgorithm digestAlgorithm, byte[] digestValue) This method allows to add a pair:DigestAlgorithm
and the corresponding digest value calculated externally on the encapsulated file.void
addDigest
(DigestAlgorithm digestAlgorithm, String base64EncodeDigest) This method allows to add a pair:DigestAlgorithm
and the corresponding digest value calculated externally on the encapsulated file.void
This method allows to add aDigest
with 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 provideddigestAlgorithm
Gets the defined digest value for the DigestDocumentOpens aInputStream
on theDSSDocument
contents.void
Save 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
-Digest
for the new DigestDocument
-
DigestDocument
-
DigestDocument
Creates DigestDocument with a digest provided in a form of byte array- Parameters:
digestAlgorithm
-DigestAlgorithm
digestValue
- byte array representing the corresponding digest value
-
DigestDocument
Creates DigestDocument with a digest provided in a form of base64-encoded String- Parameters:
digestAlgorithm
-DigestAlgorithm
base64EncodeDigest
- 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
-DigestAlgorithm
digestValue
- 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
-DigestAlgorithm
base64EncodeDigest
- the corresponding base 64 encoded digest valuename
- the name of the document
-
-
Method Details
-
addDigest
-
addDigest
This method allows to add a pair:DigestAlgorithm
and the corresponding digest value calculated externally on the encapsulated file.- Parameters:
digestAlgorithm
-DigestAlgorithm
used ot compute the digest valuedigestValue
- byte array representing the corresponding digest value
-
addDigest
This method allows to add a pair:DigestAlgorithm
and the corresponding digest value calculated externally on the encapsulated file. The digest value is base 64 encoded.- Parameters:
digestAlgorithm
-DigestAlgorithm
base64EncodeDigest
- the corresponding base 64 encoded digest value
-
getDigestValue
Description copied from interface:DSSDocument
This method returns digest value of the current document's content using the provideddigestAlgorithm
- Specified by:
getDigestValue
in interfaceDSSDocument
- Overrides:
getDigestValue
in classCommonDocument
- Parameters:
digestAlgorithm
-DigestAlgorithm
to get digest for- Returns:
- byte array representing digest of the document
-
getExistingDigest
-
openStream
Description copied from interface:DSSDocument
Opens aInputStream
on theDSSDocument
contents. The type of theInputStream
depends on the type of theDSSDocument
.- Returns:
- an
InputStream
-
save
Description copied from interface:DSSDocument
Save the content of the DSSDocument to the file.- Specified by:
save
in interfaceDSSDocument
- Overrides:
save
in classCommonDocument
- Parameters:
filePath
- the path to the file to be created- Throws:
IOException
- if any IO error happens
-