Package eu.europa.esig.dss.pdf
Class PdfPermissionsChecker
java.lang.Object
eu.europa.esig.dss.pdf.PdfPermissionsChecker
This class is used to verify permissions of a PDF document and to check whether modifications are allowed
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
alertOnForbiddenSignatureCreation
(String message) Executes thealertOnForbiddenSignatureCreation
with the givenmessage
void
checkDocumentPermissions
(PdfDocumentReader documentReader, SignatureFieldParameters fieldParameters) This method checks if the document has the necessary permissions for the signature operationvoid
checkSignatureRestrictionDictionaries
(PdfDocumentReader documentReader, SignatureFieldParameters fieldParameters) This method verifies whether a new signature is permittedprotected boolean
isDocumentChangeForbidden
(CertificationPermission certificationPermission) This method verifies and returns whether changes within a document are forbidden according to the definedcertificationPermission
protected boolean
isSignatureFieldCreationForbidden
(SigFieldPermissions sigFieldPermissions, String signatureFieldId) Checks and returns whether a signature field creation if forbidden according to the given configuration of thesignatureFieldId
void
setAlertOnForbiddenSignatureCreation
(StatusAlert alertOnForbiddenSignatureCreation) Sets a behavior to follow when creating a new signature in a document that forbids creation of new signatures Default : ExceptionOnStatusAlert - throw the exception
-
Constructor Details
-
PdfPermissionsChecker
public PdfPermissionsChecker()Default constructor to instantiate the checker
-
-
Method Details
-
setAlertOnForbiddenSignatureCreation
Sets a behavior to follow when creating a new signature in a document that forbids creation of new signatures Default : ExceptionOnStatusAlert - throw the exception- Parameters:
alertOnForbiddenSignatureCreation
-StatusAlert
to execute
-
checkDocumentPermissions
public void checkDocumentPermissions(PdfDocumentReader documentReader, SignatureFieldParameters fieldParameters) This method checks if the document has the necessary permissions for the signature operation- Parameters:
documentReader
-PdfDocumentReader
fieldParameters
-SignatureFieldParameters
-
checkSignatureRestrictionDictionaries
public void checkSignatureRestrictionDictionaries(PdfDocumentReader documentReader, SignatureFieldParameters fieldParameters) This method verifies whether a new signature is permitted- Parameters:
documentReader
-PdfDocumentReader
fieldParameters
-SignatureFieldParameters
-
isDocumentChangeForbidden
This method verifies and returns whether changes within a document are forbidden according to the definedcertificationPermission
- Parameters:
certificationPermission
-CertificationPermission
to check- Returns:
- TRUE if changes are forbidden within the document, FALSE otherwise
-
alertOnForbiddenSignatureCreation
Executes thealertOnForbiddenSignatureCreation
with the givenmessage
- Parameters:
message
-String
containing an information about document permissions' failure
-
isSignatureFieldCreationForbidden
protected boolean isSignatureFieldCreationForbidden(SigFieldPermissions sigFieldPermissions, String signatureFieldId) Checks and returns whether a signature field creation if forbidden according to the given configuration of thesignatureFieldId
- Parameters:
sigFieldPermissions
-SigFieldPermissions
permissionssignatureFieldId
-String
providing the permission configuration- Returns:
- TRUE of a signature field cretion is forbidden according to the configuration, FALSE otherwise
-