From 77cc1a7b56632d36efba616d5fd8cf4aac93b30e Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Wed, 19 May 2021 17:37:55 +0200 Subject: change analyzing of PDF protection level because it's maybe to restricted --- .../gv/egiz/pdfas/lib/impl/pdfbox2/utils/PdfBoxUtils.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'pdf-as-pdfbox-2') 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); - } } -- cgit v1.2.3