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
base64EncodeDigestMap, mimeType, name -
Constructor Summary
ConstructorsConstructorDescriptionCreates DigestDocument with an empty digest map.DigestDocument(DigestAlgorithm digestAlgorithm, String base64EncodeDigest) Creates DigestDocument.DigestDocument(DigestAlgorithm digestAlgorithm, String base64EncodeDigest, String name) Creates DigestDocument. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDigest(DigestAlgorithm digestAlgorithm, String base64EncodeDigest) This method allows to add a pair:DigestAlgorithmand the corresponding digest value calculated externally on the encapsulated file.getDigest(DigestAlgorithm digestAlgorithm) This method returns the encoded digest value of the currentDSSDocumentusing the base64 algorithm.Gets 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
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.- Parameters:
digestAlgorithm-DigestAlgorithmbase64EncodeDigest- the corresponding base 64 encoded digest value
-
DigestDocument
Creates DigestDocument.- Parameters:
digestAlgorithm-DigestAlgorithmbase64EncodeDigest- the corresponding base 64 encoded digest valuename- the name of the document
-
-
Method Details
-
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
-
getDigest
Description copied from interface:DSSDocumentThis method returns the encoded digest value of the currentDSSDocumentusing the base64 algorithm.- Specified by:
getDigestin interfaceDSSDocument- Overrides:
getDigestin classCommonDocument- Parameters:
digestAlgorithm-DigestAlgorithm- Returns:
- base64 encoded
String
-
getExistingDigest
Gets the defined digest value for the DigestDocument- Returns:
Digest
-
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
-