aboutsummaryrefslogtreecommitdiff
path: root/signature-standards/sigs-pcks7detached/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'signature-standards/sigs-pcks7detached/src/main')
-rw-r--r--signature-standards/sigs-pcks7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedSigner.java10
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);
}
}