From 73c30d3a15a33d02f7ea675e267b39310913ba4d Mon Sep 17 00:00:00 2001 From: pdanner Date: Mon, 6 Dec 2010 17:02:56 +0000 Subject: Necessary changes for separation of pdf-as-web and rest of the project git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@680 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../at/gv/egiz/pdfas/impl/api/CheckHelper.java | 28 ++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'src/main/java/at/gv/egiz/pdfas/impl/api/CheckHelper.java') diff --git a/src/main/java/at/gv/egiz/pdfas/impl/api/CheckHelper.java b/src/main/java/at/gv/egiz/pdfas/impl/api/CheckHelper.java index 83a0565..d48435a 100644 --- a/src/main/java/at/gv/egiz/pdfas/impl/api/CheckHelper.java +++ b/src/main/java/at/gv/egiz/pdfas/impl/api/CheckHelper.java @@ -10,9 +10,12 @@ import at.gv.egiz.pdfas.api.analyze.AnalyzeParameters; import at.gv.egiz.pdfas.api.commons.Constants; import at.gv.egiz.pdfas.api.io.DataSource; import at.gv.egiz.pdfas.api.sign.SignParameters; +import at.gv.egiz.pdfas.api.sign.SignatureDetailInformation; import at.gv.egiz.pdfas.api.sign.pos.SignaturePositioning; import at.gv.egiz.pdfas.api.verify.VerifyAfterAnalysisParameters; import at.gv.egiz.pdfas.api.verify.VerifyParameters; +import at.gv.egiz.pdfas.framework.signator.SignatorInformation; +import at.gv.egiz.pdfas.impl.api.sign.SignatureDetailInformationImpl; import at.knowcenter.wag.egov.egiz.exceptions.PDFDocumentException; import at.knowcenter.wag.egov.egiz.exceptions.SignatureTypesException; import at.knowcenter.wag.egov.egiz.sig.SignatureTypes; @@ -44,8 +47,9 @@ public final class CheckHelper * * @param sp * The {@link SignParameters} + * @param allowAllDevices if true, no check for non local BKUs will be done */ - public static void checkSignParameters(SignParameters sp) + public static void checkSignParameters(SignParameters sp, boolean allowAllDevices) { if (sp == null) { @@ -58,7 +62,8 @@ public final class CheckHelper throw new IllegalArgumentException("The output DataSink must not be null."); } checkSignatureType(sp.getSignatureType()); - checkSignatureDevice(sp.getSignatureDevice()); + if (!allowAllDevices) + checkSignatureDevice(sp.getSignatureDevice()); if (sp.getSignatureProfileId() != null) { checkProfileId(sp.getSignatureProfileId()); @@ -226,4 +231,23 @@ public final class CheckHelper throw new IllegalArgumentException("The signatureDevice must be one of the Constants.SIGNATURE_DEVICE_* constants. " + signatureDevice); } } + + protected static void checkSignParametersForSignAfterPrepare(SignParameters signParameters, boolean allowAllDevices) { + checkSignParameters(signParameters, allowAllDevices); + checkProfileId(signParameters.getSignatureProfileId()); + } + + public static void checkSignatorInformation(SignatorInformation signatorInfo) { + if (signatorInfo.getSignSignatureObject() == null) + { + throw new IllegalArgumentException("The signatorInformation.getSignSignatureObject() must not be null."); + } + } + + public static void checkSignatureDetailInformation(SignatureDetailInformation signatureDetailInformation) { + if (!(signatureDetailInformation instanceof SignatureDetailInformationImpl)){ + throw new IllegalArgumentException("SignatureDetailInformation is of unsupported type. Must be " + SignatureDetailInformationImpl.class.getName()); + } + + } } -- cgit v1.2.3