diff options
author | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2014-10-21 10:28:54 +0200 |
---|---|---|
committer | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2014-10-21 10:28:54 +0200 |
commit | d16a7c27a77399806d1e2c6ae082e98d456c3baf (patch) | |
tree | 309ec8c90dd8274375ebb8480dfc3e5cafeeedb6 /pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl | |
parent | 40841f154c31d8e9e6e670def11dcb5899f5db71 (diff) | |
download | pdf-as-4-d16a7c27a77399806d1e2c6ae082e98d456c3baf.tar.gz pdf-as-4-d16a7c27a77399806d1e2c6ae082e98d456c3baf.tar.bz2 pdf-as-4-d16a7c27a77399806d1e2c6ae082e98d456c3baf.zip |
PDF API update to ouput signed documents via output stream
Diffstat (limited to 'pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl')
3 files changed, 14 insertions, 21 deletions
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java index 387a6c31..4828bae3 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java @@ -26,7 +26,6 @@ package at.gv.egiz.pdfas.lib.impl; import iaik.x509.X509Certificate; import java.awt.Image; -import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; import java.util.Calendar; @@ -450,9 +449,9 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants, throws IOException { // ================================================================ // Create SignResult - SignResultImpl result = new SignResultImpl(new ByteArrayInputStream( - status.getPdfObject().getSignedDocument())); - + SignResultImpl result = new SignResultImpl(); + status.getSignParamter().getSignatureResult().write(status.getPdfObject().getSignedDocument()); + status.getSignParamter().getSignatureResult().flush(); result.setSignerCertificate(status.getRequestedSignature() .getCertificate()); result.setSignaturePosition(status.getRequestedSignature() diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/SignParameterImpl.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/SignParameterImpl.java index f547b2b0..9584e1bf 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/SignParameterImpl.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/SignParameterImpl.java @@ -23,6 +23,8 @@ ******************************************************************************/ package at.gv.egiz.pdfas.lib.impl; +import java.io.OutputStream; + import javax.activation.DataSource; import at.gv.egiz.pdfas.lib.api.Configuration; @@ -34,10 +36,12 @@ public class SignParameterImpl extends PdfAsParameterImpl implements SignParamet protected String signaturePosition = null; protected DataSource output = null; protected IPlainSigner signer = null; + protected OutputStream outputStream = null; public SignParameterImpl(Configuration configuration, - DataSource dataSource) { + DataSource dataSource, OutputStream outputStream) { super(configuration, dataSource); + this.outputStream = outputStream; } // ======================================================================== @@ -58,14 +62,6 @@ public class SignParameterImpl extends PdfAsParameterImpl implements SignParamet this.signaturePosition = signaturePosition; } - public void setOutput(DataSource output) { - this.output = output; - } - - public DataSource getOutput() { - return this.output; - } - public void setPlainSigner(IPlainSigner signer) { this.signer = signer; } @@ -73,5 +69,10 @@ public class SignParameterImpl extends PdfAsParameterImpl implements SignParamet public IPlainSigner getPlainSigner() { return this.signer; } + + @Override + public OutputStream getSignatureResult() { + return outputStream; + } } diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/SignResultImpl.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/SignResultImpl.java index 1a0e6490..f713eb6a 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/SignResultImpl.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/SignResultImpl.java @@ -23,7 +23,6 @@ ******************************************************************************/ package at.gv.egiz.pdfas.lib.impl; -import java.io.InputStream; import java.security.cert.X509Certificate; import at.gv.egiz.pdfas.lib.api.SignaturePosition; @@ -31,16 +30,10 @@ import at.gv.egiz.pdfas.lib.api.sign.SignResult; public class SignResultImpl implements SignResult { - protected InputStream dataSink; protected X509Certificate certificate; protected SignaturePosition position; - public SignResultImpl(InputStream dataSink) { - this.dataSink = dataSink; - } - - public InputStream getOutputDocument() { - return this.dataSink; + public SignResultImpl() { } public X509Certificate getSignerCertificate() { |