aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-lib/src/main/java/at/gv/egiz/pdfas
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-as-lib/src/main/java/at/gv/egiz/pdfas')
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsParameter.java4
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/sign/IPlainSigner.java4
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java4
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsParameterImpl.java10
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PdfboxSignerWrapper.java7
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/status/OperationStatus.java7
6 files changed, 30 insertions, 6 deletions
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsParameter.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsParameter.java
index 3f37eebb..bb35f68f 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsParameter.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsParameter.java
@@ -48,4 +48,8 @@ public interface PdfAsParameter {
* @param dataSource
*/
public void setDataSource(DataSource dataSource);
+
+ public String getTransactionId();
+
+ public void setTransactionId(String id);
}
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/sign/IPlainSigner.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/sign/IPlainSigner.java
index 8ab770e7..903b9630 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/sign/IPlainSigner.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/sign/IPlainSigner.java
@@ -39,7 +39,7 @@ public interface IPlainSigner {
* @return
* @throws PdfAsException
*/
- public X509Certificate getCertificate() throws PdfAsException;
+ public X509Certificate getCertificate(SignParameter parameter) throws PdfAsException;
/**
* Sign the document
@@ -48,7 +48,7 @@ public interface IPlainSigner {
* @return
* @throws PdfAsException
*/
- public byte[] sign(byte[] input, int[] byteRange) throws PdfAsException;
+ public byte[] sign(byte[] input, int[] byteRange, SignParameter parameter) throws PdfAsException;
/**
* Gets the PDF Subfilter for this signer
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 c40704b1..b146edfe 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
@@ -149,7 +149,7 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants {
status.setRequestedSignature(requestedSignature);
requestedSignature.setCertificate(status.getSignParamter()
- .getPlainSigner().getCertificate());
+ .getPlainSigner().getCertificate(parameter));
// Only use this profileID because validation was done in
// RequestedSignature
@@ -168,7 +168,7 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants {
IPdfSigner signer = PdfSignerFactory.createPdfSigner();
signer.signPDF(status.getPdfObject(), requestedSignature,
new PdfboxSignerWrapper(status.getSignParamter()
- .getPlainSigner()));
+ .getPlainSigner(), parameter));
// ================================================================
// Create SignResult
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsParameterImpl.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsParameterImpl.java
index c9e8ef54..362715a3 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsParameterImpl.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsParameterImpl.java
@@ -31,11 +31,13 @@ public class PdfAsParameterImpl implements PdfAsParameter {
protected Configuration configuration;
protected DataSource dataSource;
+ protected String transactionId;
public PdfAsParameterImpl(Configuration configuration,
DataSource dataSource) {
this.configuration = configuration;
this.dataSource = dataSource;
+ this.transactionId = null;
}
public Configuration getConfiguration() {
@@ -53,4 +55,12 @@ protected Configuration configuration;
public void setDataSource(DataSource dataSource) {
this.dataSource = dataSource;
}
+
+ public String getTransactionId() {
+ return transactionId;
+ }
+
+ public void setTransactionId(String id) {
+ this.transactionId = id;
+ }
}
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PdfboxSignerWrapper.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PdfboxSignerWrapper.java
index 0925a646..faa49148 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PdfboxSignerWrapper.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PdfboxSignerWrapper.java
@@ -37,6 +37,7 @@ import at.gv.egiz.pdfas.common.exceptions.PdfAsWrappedIOException;
import at.gv.egiz.pdfas.common.utils.PDFUtils;
import at.gv.egiz.pdfas.common.utils.StreamUtils;
import at.gv.egiz.pdfas.lib.api.sign.IPlainSigner;
+import at.gv.egiz.pdfas.lib.api.sign.SignParameter;
import at.gv.egiz.pdfas.lib.impl.signing.sig_interface.PDFASSignatureInterface;
public class PdfboxSignerWrapper implements PDFASSignatureInterface {
@@ -49,10 +50,12 @@ public class PdfboxSignerWrapper implements PDFASSignatureInterface {
private PDSignature signature;
private int[] byteRange;
private Calendar date;
+ private SignParameter parameters;
- public PdfboxSignerWrapper(IPlainSigner signer) {
+ public PdfboxSignerWrapper(IPlainSigner signer, SignParameter parameters) {
this.signer = signer;
this.date = Calendar.getInstance();
+ this.parameters = parameters;
}
public byte[] sign(InputStream inputStream) throws SignatureException,
@@ -63,7 +66,7 @@ public class PdfboxSignerWrapper implements PDFASSignatureInterface {
logger.info("Byte Range 2: " + byteRange2);
try {
logger.info("Signing with Pdfbox Wrapper");
- byte[] signature = signer.sign(data, byteRange);
+ byte[] signature = signer.sign(data, byteRange, this.parameters);
return signature;
} catch (PdfAsException e) {
throw new PdfAsWrappedIOException(e);
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/status/OperationStatus.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/status/OperationStatus.java
index 75eee27f..4a8445b5 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/status/OperationStatus.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/status/OperationStatus.java
@@ -156,4 +156,11 @@ public class OperationStatus implements Serializable {
this.signingDate = signingDate;
}
+ public String getTransactionId() {
+ if(this.signParamter != null) {
+ return this.signParamter.getTransactionId();
+ }
+ return null;
+ }
+
}