aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-lib
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-as-lib')
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java2
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/sl/util/ISignatureConnectorSLWrapper.java14
2 files changed, 15 insertions, 1 deletions
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java
index 03e72ecc..24af4ad8 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java
@@ -83,6 +83,8 @@ public interface IConfigurationConstants {
*/
public static final String MOA_SIGN_URL = "moa.sign.url";
+ public static final String KEEP_INVALID_SIGNATURE = "report.invalidSign";
+
public static final String MOC_SIGN_URL = "moc.sign.url";
public static final String MOBILE_SIGN_URL = "mobile.sign.url";
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/ISignatureConnectorSLWrapper.java b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/ISignatureConnectorSLWrapper.java
index 49a450af..0b6b1fff 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/ISignatureConnectorSLWrapper.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/ISignatureConnectorSLWrapper.java
@@ -28,6 +28,7 @@ import iaik.x509.X509Certificate;
import java.security.cert.CertificateException;
import java.util.Iterator;
+import org.apache.commons.codec.binary.Base64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -36,7 +37,9 @@ import at.gv.egiz.pdfas.common.exceptions.PDFASError;
import at.gv.egiz.pdfas.common.exceptions.PdfAsErrorCarrier;
import at.gv.egiz.pdfas.common.exceptions.PdfAsException;
import at.gv.egiz.pdfas.common.exceptions.PdfAsSignatureException;
+import at.gv.egiz.pdfas.common.utils.SettingsUtils;
import at.gv.egiz.pdfas.common.utils.StreamUtils;
+import at.gv.egiz.pdfas.lib.api.IConfigurationConstants;
import at.gv.egiz.pdfas.lib.api.sign.SignParameter;
import at.gv.egiz.pdfas.lib.api.verify.VerifyResult;
import at.gv.egiz.pdfas.lib.impl.status.RequestedSignature;
@@ -109,11 +112,20 @@ public class ISignatureConnectorSLWrapper implements ISignatureConnector {
break;
}
}
-
+
VerifyResult verifyResult;
try {
verifyResult = SignatureUtils.verifySignature(
response.getCMSSignature(), input);
+ if(SettingsUtils.getBooleanValue(requestedSignature.getStatus().getSettings(),
+ IConfigurationConstants.KEEP_INVALID_SIGNATURE, false)) {
+ Base64 b64 = new Base64();
+ requestedSignature
+ .getStatus()
+ .getMetaInformations()
+ .put(ErrorConstants.STATUS_INFO_INVALIDSIG,
+ b64.encodeToString(response.getCMSSignature()));
+ }
} catch (PDFASError e) {
throw new PdfAsErrorCarrier(e);
}