From e210f9d25fb530a2650059390f12a7e8ecec48b3 Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Tue, 28 Jan 2014 13:49:33 +0100 Subject: PDF-AS cleanups --- .../main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java | 11 +++++++---- .../main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java | 15 ++++++++++++++- 2 files changed, 21 insertions(+), 5 deletions(-) (limited to 'pdf-as-lib/src/main/java/at/gv') diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java index 284573e0..3f5888fc 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java @@ -1,5 +1,6 @@ package at.gv.egiz.pdfas.lib.api; +import iaik.cms.IaikCCProvider; import iaik.security.ec.provider.ECCelerate; import iaik.security.provider.IAIK; @@ -40,16 +41,18 @@ public class PdfAsFactory { static { - System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); - System.out.println("+ PDF-AS: " + getVersion()); - System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); - /* * PropertyConfigurator.configure(ClassLoader * .getSystemResourceAsStream("resources/log4j.properties")); */ IAIK.addAsProvider(); ECCelerate.addAsProvider(); + + System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); + System.out.println("+ PDF-AS: " + getVersion()); + System.out.println("+ IAIK-JCE Version: " + IAIK.getVersionInfo()); + System.out.println("+ ECCelerate Version: " + ECCelerate.getInstance().getVersion()); + System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); } private static boolean log_configured = false; 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 04b385f7..540fd572 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 @@ -87,6 +87,14 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants { } } + if(parameter.getDataSource() == null || parameter.getDataSource().getByteData() == null) { + throw new PdfAsValidationException("error.pdf.sig.10", null); + } + + if(parameter.getOutput() == null) { + throw new PdfAsValidationException("error.pdf.sig.11", null); + } + // TODO: verify Sign Parameter } @@ -96,6 +104,10 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants { if (!(parameter.getConfiguration() instanceof ISettings)) { throw new PdfAsSettingsException("Invalid settings object!"); } + + if(parameter.getDataSource() == null || parameter.getDataSource().getByteData() == null) { + throw new PdfAsValidationException("error.pdf.verify.01", null); + } // TODO: verify Verify Parameter } @@ -279,7 +291,8 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants { public StatusRequest startSign(SignParameter parameter) throws PdfAsException { - // TODO: VERIFY PARAMETERS + verifySignParameter(parameter); + StatusRequestImpl request = new StatusRequestImpl(); try { -- cgit v1.2.3