aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz/pdfas/impl/api/CheckHelper.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/gv/egiz/pdfas/impl/api/CheckHelper.java')
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/api/CheckHelper.java28
1 files changed, 26 insertions, 2 deletions
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());
+ }
+
+ }
}