diff options
author | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2013-11-12 12:26:10 +0100 |
---|---|---|
committer | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2013-11-12 12:26:10 +0100 |
commit | 7b2e2b640b0f392183f7927f692936950d3fabfc (patch) | |
tree | ffd4acccb62f2679ff613bf0cd8cd0850186b465 /signature-standards/sigs-pcks7detached/src/main/java | |
parent | dd43264f702c5e0351cc63835862c55f3e847634 (diff) | |
download | pdf-as-4-7b2e2b640b0f392183f7927f692936950d3fabfc.tar.gz pdf-as-4-7b2e2b640b0f392183f7927f692936950d3fabfc.tar.bz2 pdf-as-4-7b2e2b640b0f392183f7927f692936950d3fabfc.zip |
SecurityLayer commands included
Diffstat (limited to 'signature-standards/sigs-pcks7detached/src/main/java')
-rw-r--r-- | signature-standards/sigs-pcks7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedSigner.java | 10 |
1 files changed, 7 insertions, 3 deletions
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); } } |