diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java index 6a19b42..6d5e399 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java @@ -32,7 +32,6 @@ import org.apache.commons.logging.LogFactory; import at.gv.egiz.pdfas.api.analyze.NonTextObjectInfo;
import at.gv.egiz.pdfas.api.commons.DynamicSignatureProfileImpl;
-import at.gv.egiz.pdfas.api.exceptions.PdfAsException;
import at.gv.egiz.pdfas.api.commons.SignatureInformation;
import at.gv.egiz.pdfas.api.timestamp.TimeStamper;
import at.gv.egiz.pdfas.api.xmldsig.ExtendedSignatureInformation;
@@ -914,14 +913,33 @@ public abstract class PdfAS cp.setVerificationTime(verificationTime);
Connector c = at.gv.egiz.pdfas.framework.ConnectorFactory.createConnector(connectorId, cp);
- SignatureResponse res = null;
- try {
- return c.doVerify(sd, so, dsig);
- } catch (PdfAsException e) {
- res = new SignatureResponse();
- res.setVerificationImpossibleEx(e);
- }
- return res;
+ return executeVerify(dsig, so, sd, c);
+ }
+
+ private static SignatureResponse executeVerify(XMLDsigData dsig, SignSignatureObject so,
+ SignatureData sd, Connector c) throws ConnectorException {
+ SignatureResponse res = null;
+ try {
+ return c.doVerify(sd, so, dsig);
+ } catch (ConnectorException e) {
+ if (suppressVerifyException()) {
+ res = new SignatureResponse();
+ res.setVerificationImpossibleEx(e);
+ } else {
+ throw e;
+ }
+ }
+ return res;
+ }
+
+ private static boolean suppressVerifyException() {
+ String propKey = "suppress_validate_exceptions";
+ try {
+ return SettingsReader.getInstance().getSetting(propKey).equalsIgnoreCase("true");
+ } catch (Exception e) {
+ log.debug("'" + propKey + "' property not found, using default value 'false'");
+ return false;
+ }
}
public static SignatureResponse verifyWeb(SignatureHolder signature_holder, String connector, String loc_ref) throws NormalizeException, PDFDocumentException, SignatureException, ConnectorException
@@ -960,15 +978,7 @@ public abstract class PdfAS String profile = so_to_be_verified.getSignatureTypeDefinition().getType();
Connector c = ConnectorChooser.chooseWebConnectorForVerify(connector, so_to_be_verified.getKZ(), so.id, profile, loc_ref);
- SignatureResponse res = null;
- try {
- return c.doVerify(sd, so, null);
- } catch (PdfAsException e) {
- res = new SignatureResponse();
- res.setVerificationImpossibleEx(e);
- }
-
- return res;
+ return executeVerify(null, so, sd, c);
}
|