aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-moa/src/main/java/at/gv/egiz
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-10-30 17:25:31 +0100
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-10-30 17:25:31 +0100
commitd82c9837a3f7c250ed116487ab874b6825562e1f (patch)
tree559065142b1483eff007223aeca134a9e386649c /pdf-as-moa/src/main/java/at/gv/egiz
parentfb3344c1e4d4ac8e8a6aa5605d052cee8cd4c3b1 (diff)
downloadpdf-as-4-d82c9837a3f7c250ed116487ab874b6825562e1f.tar.gz
pdf-as-4-d82c9837a3f7c250ed116487ab874b6825562e1f.tar.bz2
pdf-as-4-d82c9837a3f7c250ed116487ab874b6825562e1f.zip
added Option to keep invalid signatures
Diffstat (limited to 'pdf-as-moa/src/main/java/at/gv/egiz')
-rw-r--r--pdf-as-moa/src/main/java/at/gv/egiz/pdfas/moa/MOAConnector.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/pdf-as-moa/src/main/java/at/gv/egiz/pdfas/moa/MOAConnector.java b/pdf-as-moa/src/main/java/at/gv/egiz/pdfas/moa/MOAConnector.java
index c3e417d2..212e4116 100644
--- a/pdf-as-moa/src/main/java/at/gv/egiz/pdfas/moa/MOAConnector.java
+++ b/pdf-as-moa/src/main/java/at/gv/egiz/pdfas/moa/MOAConnector.java
@@ -35,6 +35,7 @@ import java.security.cert.CertificateException;
import javax.xml.ws.BindingProvider;
+import org.apache.commons.codec.binary.Base64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -57,6 +58,7 @@ import at.gv.egiz.pdfas.common.exceptions.PdfAsMOAException;
import at.gv.egiz.pdfas.common.exceptions.PdfAsSignatureException;
import at.gv.egiz.pdfas.common.exceptions.PdfAsWrappedIOException;
import at.gv.egiz.pdfas.common.settings.ISettings;
+import at.gv.egiz.pdfas.common.utils.SettingsUtils;
import at.gv.egiz.pdfas.common.utils.StreamUtils;
import at.gv.egiz.pdfas.lib.api.Configuration;
import at.gv.egiz.pdfas.lib.api.IConfigurationConstants;
@@ -232,6 +234,15 @@ public class MOAConnector implements ISignatureConnector,
try {
verifyResult = SignatureUtils.verifySignature(cmsSignatureData,
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(cmsSignatureData));
+ }
} catch (PDFASError e) {
throw new PdfAsErrorCarrier(e);
}