diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/gv/egiz/pdfas/api/verify/VerifyParameters.java | 25 | ||||
-rw-r--r-- | src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java | 13 |
2 files changed, 27 insertions, 11 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyParameters.java b/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyParameters.java index 793764b..9cc86a7 100644 --- a/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyParameters.java +++ b/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyParameters.java @@ -79,7 +79,13 @@ public class VerifyParameters protected boolean returnHashInputData = false;
protected boolean returnNonTextualObjects = false;
+
+ private static ThreadLocal suppressVerifyExceptions = new ThreadLocal();
+
+ public VerifyParameters() {
+ suppressVerifyExceptions.set(Boolean.FALSE);
+ }
/**
* @return the document
*/
@@ -196,6 +202,25 @@ public class VerifyParameters public void setReturnNonTextualObjects(boolean returnNonTextualObjects) {
this.returnNonTextualObjects = returnNonTextualObjects;
}
+
+ /**
+ * Set if verify exceptions (because of unknown signatures) are suppressed or not (default).
+ * Suppressing can be helpful for multiple signatures if you want to verify the working rest. Unsupported
+ * Signatures are reported without throwing an exception via {@link VerifyResult#getVerificationException()}
+ * @param suppress
+ */
+ public void setSuppressVerifyExceptions(boolean suppress) {
+ suppressVerifyExceptions.set(new Boolean(suppress));
+ }
+
+ /**
+ * See {@link #setSuppressVerifyExceptions(boolean)}
+ * @return
+ */
+ public static boolean isSuppressVerifyExceptions() {
+ if (suppressVerifyExceptions.get() == null) return false;
+ return ((Boolean) suppressVerifyExceptions.get()).booleanValue();
+ }
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 6d5e399..dca71ba 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java @@ -34,6 +34,7 @@ import at.gv.egiz.pdfas.api.analyze.NonTextObjectInfo; import at.gv.egiz.pdfas.api.commons.DynamicSignatureProfileImpl;
import at.gv.egiz.pdfas.api.commons.SignatureInformation;
import at.gv.egiz.pdfas.api.timestamp.TimeStamper;
+import at.gv.egiz.pdfas.api.verify.VerifyParameters;
import at.gv.egiz.pdfas.api.xmldsig.ExtendedSignatureInformation;
import at.gv.egiz.pdfas.api.xmldsig.XMLDsigData;
import at.gv.egiz.pdfas.commandline.CommandlineConnectorChooser;
@@ -922,7 +923,7 @@ public abstract class PdfAS try {
return c.doVerify(sd, so, dsig);
} catch (ConnectorException e) {
- if (suppressVerifyException()) {
+ if (VerifyParameters.isSuppressVerifyExceptions()) {
res = new SignatureResponse();
res.setVerificationImpossibleEx(e);
} else {
@@ -932,16 +933,6 @@ public abstract class PdfAS 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
{
// String text_to_be_verified = signature_holder.getSignedText();
|