From 0b663afa4d0167df1e838e1f37bb5862e8951037 Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Wed, 15 Oct 2014 18:07:20 +0200 Subject: PDF-AS Errorhandling redesign only PDFASError Exceptions are returned ! --- .../java/at/gv/egiz/sl/util/ISignatureConnectorSLWrapper.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'pdf-as-lib/src/main/java/at/gv/egiz/sl') 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 82dc0602..19dc3d76 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 @@ -27,17 +27,17 @@ import iaik.x509.X509Certificate; import java.security.cert.CertificateException; import java.util.Iterator; -import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +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.StreamUtils; 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.SignResultImpl; import at.gv.egiz.pdfas.lib.impl.status.RequestedSignature; import at.gv.egiz.pdfas.lib.util.SignatureUtils; import at.gv.egiz.sl.schema.CreateCMSSignatureResponseType; @@ -90,7 +90,12 @@ public class ISignatureConnectorSLWrapper implements ISignatureConnector { CreateCMSSignatureResponseType response = connector .sendCMSRequest(pack, parameter); - VerifyResult verifyResult = SignatureUtils.verifySignature(response.getCMSSignature(), input); + VerifyResult verifyResult; + try { + verifyResult = SignatureUtils.verifySignature(response.getCMSSignature(), input); + } catch (PDFASError e) { + throw new PdfAsErrorCarrier(e); + } if(!StreamUtils.dataCompare(requestedSignature.getCertificate().getFingerprintSHA(), ((X509Certificate)verifyResult.getSignerCertificate()).getFingerprintSHA())) { -- cgit v1.2.3