Package eu.europa.esig.dss.asic.common
Class SecureContainerHandlerBuilder
java.lang.Object
eu.europa.esig.dss.asic.common.SecureContainerHandlerBuilder
- All Implemented Interfaces:
ZipContainerHandlerBuilder<SecureContainerHandler>
public class SecureContainerHandlerBuilder
extends Object
implements ZipContainerHandlerBuilder<SecureContainerHandler>
Default implementation of a builder,
building a new instance of
eu.europa.esig.dss.asic.common.SecureContainerHandler
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds a new instance ofZipContainerHandler
setExtractComments
(boolean extractComments) Sets whether comments of ZIP entries shall be extracted.setMaxAllowedFilesAmount
(int maxAllowedFilesAmount) Sets the maximum allowed amount of files inside a containersetMaxCompressionRatio
(long maxCompressionRatio) Sets the maximum allowed compression ratio If the container compression ratio exceeds the value, an exception is being thrownsetMaxMalformedFiles
(int maxMalformedFiles) Sets the maximum allowed amount of malformed filessetResourcesHandlerBuilder
(DSSResourcesHandlerBuilder resourcesHandlerBuilder) SetsDSSResourcesFactoryBuilder
to be used for aDSSResourcesHandler
creation in internal methods.setThreshold
(long threshold) Sets the maximum allowed threshold after exceeding each the security checks are enforced
-
Constructor Details
-
SecureContainerHandlerBuilder
public SecureContainerHandlerBuilder()Default constructor
-
-
Method Details
-
setThreshold
Sets the maximum allowed threshold after exceeding each the security checks are enforcedDefault : 1000000 (1 MB)
- Parameters:
threshold
- in bytes- Returns:
SecureContainerHandlerBuilder
-
setMaxCompressionRatio
Sets the maximum allowed compression ratio If the container compression ratio exceeds the value, an exception is being thrownDefault : 100
- Parameters:
maxCompressionRatio
- the maximum compression ratio- Returns:
SecureContainerHandlerBuilder
-
setMaxAllowedFilesAmount
Sets the maximum allowed amount of files inside a containerDefault : 1000
- Parameters:
maxAllowedFilesAmount
- the maximum number of allowed files- Returns:
SecureContainerHandlerBuilder
-
setMaxMalformedFiles
Sets the maximum allowed amount of malformed filesDefault : 100
- Parameters:
maxMalformedFiles
- the maximum number of malformed files- Returns:
SecureContainerHandlerBuilder
-
setExtractComments
Sets whether comments of ZIP entries shall be extracted.Enabling of the feature can be useful when editing an existing archive, in order to preserve the existing data (i.e. comments). When enabled, slightly decreases the performance (about 10% for
extractContainerContent(zipArchive)
method).Reason : All ZIP entries from a ZIP archive are extracted using
java.util.zip.ZipInputStream
, that is not able to extract comments for entries. In order to extract comments, the archive shall be read again usingjava.util.zip.ZipFile
. For more information about limitations please see<a href="https://stackoverflow.com/a/70848140">the link</a>
.Default : false (not extracted)
- Parameters:
extractComments
- whether comments shall be extracted- Returns:
SecureContainerHandlerBuilder
-
setResourcesHandlerBuilder
public SecureContainerHandlerBuilder setResourcesHandlerBuilder(DSSResourcesHandlerBuilder resourcesHandlerBuilder) SetsDSSResourcesFactoryBuilder
to be used for aDSSResourcesHandler
creation in internal methods.DSSResourcesHandler
defines a way to operate with OutputStreams and createDSSDocument
s. Default :eu.europa.esig.dss.signature.resources.InMemoryResourcesHandler
. Works with data in memory.- Parameters:
resourcesHandlerBuilder
-DSSResourcesHandlerBuilder
- Returns:
SecureContainerHandlerBuilder
-
build
Description copied from interface:ZipContainerHandlerBuilder
Builds a new instance ofZipContainerHandler
- Specified by:
build
in interfaceZipContainerHandlerBuilder<SecureContainerHandler>
- Returns:
ZipContainerHandler
-