aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-lib
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-02-04 08:36:05 +0100
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-02-04 08:36:05 +0100
commit6b692931c81fd0e09d8d21eb81e05a5f08af8342 (patch)
tree9ee012c549cf0e4e4af05de4ff28920bb603e7e2 /pdf-as-lib
parent09dfbe9ba1b1f4469044b4bf1004df3740a8ae9d (diff)
downloadpdf-as-4-6b692931c81fd0e09d8d21eb81e05a5f08af8342.tar.gz
pdf-as-4-6b692931c81fd0e09d8d21eb81e05a5f08af8342.tar.bz2
pdf-as-4-6b692931c81fd0e09d8d21eb81e05a5f08af8342.zip
Implemented PDF Document permission check
Diffstat (limited to 'pdf-as-lib')
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java
index 540fd572..2553ccf3 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java
@@ -16,6 +16,7 @@ import org.apache.pdfbox.cos.COSDictionary;
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.cos.COSString;
import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.pdmodel.encryption.AccessPermission;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -95,6 +96,14 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants {
throw new PdfAsValidationException("error.pdf.sig.11", null);
}
+ try {
+ PDDocument doc = PDDocument.load(new ByteArrayInputStream(parameter.getDataSource().getByteData()));
+ PDFUtils.checkPDFPermissions(doc);
+ doc.close();
+ } catch(IOException e) {
+ throw new PdfAsValidationException("error.pdf.sig.12", null, e);
+ }
+
// TODO: verify Sign Parameter
}