aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-pdfbox-2
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-as-pdfbox-2')
-rw-r--r--pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/utils/PdfBoxUtils.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/utils/PdfBoxUtils.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/utils/PdfBoxUtils.java
index 1a6499ac..d072a474 100644
--- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/utils/PdfBoxUtils.java
+++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/utils/PdfBoxUtils.java
@@ -16,15 +16,18 @@ public class PdfBoxUtils {
public static void checkPDFPermissions(PDDocument doc)
throws PdfAsValidationException {
-
AccessPermission accessPermission = doc.getCurrentAccessPermission();
- if (doc.isEncrypted()) {
- throw new PdfAsValidationException("error.pdf.sig.12", null);
+ if (doc.isEncrypted() || !accessPermission.isOwnerPermission()) {
+ if (accessPermission.canModify() || accessPermission.canModifyAnnotations()
+ || accessPermission.canFillInForm()) {
+ logger.debug("Document is protected, but Signing is allowed");
+
+ } else {
+ throw new PdfAsValidationException("error.pdf.sig.12", null);
+
+ }
}
- if (!accessPermission.isOwnerPermission()) {
- throw new PdfAsValidationException("error.pdf.sig.12", null);
- }
}