From 7b2e2b640b0f392183f7927f692936950d3fabfc Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Tue, 12 Nov 2013 12:26:10 +0100 Subject: SecurityLayer commands included --- .../gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedSigner.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'signature-standards/sigs-pcks7detached/src/main') diff --git a/signature-standards/sigs-pcks7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedSigner.java b/signature-standards/sigs-pcks7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedSigner.java index 864a31d1..c6b12897 100644 --- a/signature-standards/sigs-pcks7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedSigner.java +++ b/signature-standards/sigs-pcks7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedSigner.java @@ -23,7 +23,9 @@ import org.apache.pdfbox.cos.COSName; import org.apache.pdfbox.exceptions.SignatureException; import org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature; +import at.gv.egiz.pdfas.common.exceptions.PDFIOException; import at.gv.egiz.pdfas.common.exceptions.PdfAsException; +import at.gv.egiz.pdfas.common.exceptions.PdfAsSignatureException; import at.gv.egiz.pdfas.lib.api.sign.IPlainSigner; public class PKCS7DetachedSigner implements IPlainSigner { @@ -49,7 +51,7 @@ public class PKCS7DetachedSigner implements IPlainSigner { return cert; } - public byte[] sign(byte[] input) throws SignatureException, IOException { + public byte[] sign(byte[] input, int[] byteRange) throws PdfAsException { try { SignedDataStream signed_data_stream = new SignedDataStream( new ByteArrayInputStream(input), SignedDataStream.EXPLICIT); @@ -71,9 +73,11 @@ public class PKCS7DetachedSigner implements IPlainSigner { signed_data_stream.writeTo(baos); return baos.toByteArray(); } catch (NoSuchAlgorithmException e) { - throw new SignatureException(e); + throw new PdfAsSignatureException("", e); } catch (X509ExtensionException e) { - throw new SignatureException(e); + throw new PdfAsSignatureException("", e); + } catch (IOException e) { + throw new PDFIOException("", e); } } -- cgit v1.2.3