From 7b402478784fe7237ade7c32d07f034fd7083bb7 Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Mon, 24 Nov 2014 15:45:18 +0100 Subject: verification changes --- .../at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'signature-standards/sigs-pades/src/main/java/at') diff --git a/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java b/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java index d50a2c95..99138714 100644 --- a/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java +++ b/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java @@ -65,8 +65,10 @@ import at.gv.egiz.pdfas.common.exceptions.PdfAsSignatureException; import at.gv.egiz.pdfas.lib.api.PdfAsFactory; import at.gv.egiz.pdfas.lib.api.sign.IPlainSigner; 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; import at.gv.egiz.pdfas.lib.util.CertificateUtils; +import at.gv.egiz.pdfas.lib.util.SignatureUtils; public class PAdESSignerKeystore implements IPlainSigner, PAdESConstants { @@ -305,8 +307,12 @@ public class PAdESSignerKeystore implements IPlainSigner, PAdESConstants { while ((r = dataIs.read(buf)) > 0) ; // skip data ContentInfo ci = new ContentInfo(si); - - return ci.getEncoded(); + byte[] signature = ci.getEncoded(); + + VerifyResult verifyResult = SignatureUtils.verifySignature( + signature, input); + + return signature; } catch (NoSuchAlgorithmException e) { throw new PdfAsSignatureException("error.pdf.sig.01", e); } catch (iaik.cms.CMSException e) { @@ -317,6 +323,8 @@ public class PAdESSignerKeystore implements IPlainSigner, PAdESConstants { throw new PdfAsSignatureException("error.pdf.sig.01", e); } catch (CodingException e) { throw new PdfAsSignatureException("error.pdf.sig.01", e); + } catch (PDFASError e) { + throw new PdfAsSignatureException("error.pdf.sig.01", e); } } -- cgit v1.2.3