aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-06-04 16:12:10 +0200
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-06-04 16:12:10 +0200
commit94c33f3d604ebf9a37dba551eb822b57ebfea902 (patch)
treeeeca7b8e723246f688f76958186bacefcc40297a
parent309c89cfcadf7787ab729ed2903ba1b75aeb1d3c (diff)
downloadpdf-as-4-94c33f3d604ebf9a37dba551eb822b57ebfea902.tar.gz
pdf-as-4-94c33f3d604ebf9a37dba551eb822b57ebfea902.tar.bz2
pdf-as-4-94c33f3d604ebf9a37dba551eb822b57ebfea902.zip
Added TransactionId for Signatures
-rw-r--r--pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java5
-rw-r--r--pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/PdfAsObject.java4
-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
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BKUSLConnector.java18
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BaseSLConnector.java5
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/sl/util/ISLConnector.java9
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/sl/util/ISignatureConnector.java5
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/sl/util/ISignatureConnectorSLWrapper.java13
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/sl/util/MOAConnector.java5
-rw-r--r--signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSigner.java9
-rw-r--r--signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java5
-rw-r--r--signature-standards/sigs-pkcs7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedSigner.java5
17 files changed, 82 insertions, 37 deletions
diff --git a/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java b/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java
index 37f8486f..eee47888 100644
--- a/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java
+++ b/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java
@@ -28,6 +28,7 @@ import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.Iterator;
import java.util.List;
+import java.util.UUID;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
@@ -319,6 +320,10 @@ public class Main {
SignParameter signParameter = PdfAsFactory.createSignParameter(
configuration, dataSource);
+ String id = UUID.randomUUID().toString();
+ signParameter.setTransactionId(id);
+ System.out.println("Transaction: " + id);
+
IPlainSigner slConnector = null;
if (connector != null) {
diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/PdfAsObject.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/PdfAsObject.java
index 005e3963..9ed02053 100644
--- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/PdfAsObject.java
+++ b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/PdfAsObject.java
@@ -87,7 +87,7 @@ public class PdfAsObject implements PdfAs {
if (request.needSignature()) {
try {
byte[] signature = sdi.wrapper.getSignParameter4().getPlainSigner().sign(
- request.getSignatureData(), request.getSignatureDataByteRange());
+ request.getSignatureData(), request.getSignatureDataByteRange(), sdi.wrapper.getSignParameter4());
request.setSigature(signature);
request = this.pdfas4.process(request);
if(request.isReady()) {
@@ -233,7 +233,7 @@ public class PdfAsObject implements PdfAs {
if (request.needCertificate()) {
X509Certificate certificate = signParameter4.getPlainSigner()
- .getCertificate();
+ .getCertificate(signParameter4);
sdi = new SignatureDetailInformationWrapper(certificate);
request.setCertificate(certificate.getEncoded());
request = this.pdfas4.process(request);
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;
+ }
+
}
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BKUSLConnector.java b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BKUSLConnector.java
index afceb96f..204fd727 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BKUSLConnector.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BKUSLConnector.java
@@ -46,6 +46,7 @@ import at.gv.egiz.pdfas.common.exceptions.PdfAsException;
import at.gv.egiz.pdfas.common.exceptions.SLPdfAsException;
import at.gv.egiz.pdfas.common.utils.PDFUtils;
import at.gv.egiz.pdfas.lib.api.Configuration;
+import at.gv.egiz.pdfas.lib.api.sign.SignParameter;
import at.gv.egiz.sl.schema.CreateCMSSignatureResponseType;
import at.gv.egiz.sl.schema.ErrorResponseType;
import at.gv.egiz.sl.schema.InfoboxReadRequestType;
@@ -69,7 +70,7 @@ public class BKUSLConnector extends BaseSLConnector {
return builder.build();
}
- private String performHttpRequestToBKU(String xmlRequest, RequestPackage pack)
+ private String performHttpRequestToBKU(String xmlRequest, RequestPackage pack, SignParameter parameter)
throws ClientProtocolException, IOException, IllegalStateException {
CloseableHttpClient client = null;
try {
@@ -81,6 +82,13 @@ public class BKUSLConnector extends BaseSLConnector {
entityBuilder.addTextBody(XMLREQUEST, xmlRequest,
ContentType.TEXT_XML);
+ if(parameter != null) {
+ String transactionId = parameter.getTransactionId();
+ if(transactionId != null) {
+ entityBuilder.addTextBody("TransactionId_", transactionId);
+ }
+ }
+
if(pack != null && pack.getSignatureData() != null) {
entityBuilder.addBinaryBody("fileupload",
PDFUtils.blackOutSignature(pack.getSignatureData(), pack.getByteRange()));
@@ -115,7 +123,7 @@ public class BKUSLConnector extends BaseSLConnector {
}
public InfoboxReadResponseType sendInfoboxReadRequest(
- InfoboxReadRequestType request) throws PdfAsException {
+ InfoboxReadRequestType request, SignParameter parameter) throws PdfAsException {
JAXBElement<?> element = null;
String slRequest;
try {
@@ -123,7 +131,7 @@ public class BKUSLConnector extends BaseSLConnector {
.createInfoboxReadRequest(request));
logger.trace(slRequest);
- String slResponse = performHttpRequestToBKU(slRequest, null);
+ String slResponse = performHttpRequestToBKU(slRequest, null, parameter);
element = (JAXBElement<?>) SLMarschaller
.unmarshalFromString(slResponse);
@@ -154,7 +162,7 @@ public class BKUSLConnector extends BaseSLConnector {
}
public CreateCMSSignatureResponseType sendCMSRequest(
- RequestPackage pack) throws PdfAsException {
+ RequestPackage pack, SignParameter parameter) throws PdfAsException {
JAXBElement<?> element = null;
String slRequest;
try {
@@ -162,7 +170,7 @@ public class BKUSLConnector extends BaseSLConnector {
.createCreateCMSSignatureRequest(pack.getRequestType()));
logger.debug(slRequest);
- String slResponse = performHttpRequestToBKU(slRequest, pack);
+ String slResponse = performHttpRequestToBKU(slRequest, pack, parameter);
element = (JAXBElement<?>) SLMarschaller
.unmarshalFromString(slResponse);
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BaseSLConnector.java b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BaseSLConnector.java
index 5321ed51..99cdb9f8 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BaseSLConnector.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BaseSLConnector.java
@@ -30,6 +30,7 @@ import org.slf4j.LoggerFactory;
import at.gv.egiz.pdfas.common.exceptions.PDFIOException;
import at.gv.egiz.pdfas.common.utils.PDFUtils;
+import at.gv.egiz.pdfas.lib.api.sign.SignParameter;
import at.gv.egiz.sl.schema.Base64OptRefContentType;
import at.gv.egiz.sl.schema.Base64XMLLocRefContentType;
import at.gv.egiz.sl.schema.Base64XMLLocRefOptRefContentType;
@@ -60,7 +61,7 @@ public abstract class BaseSLConnector implements ISLConnector {
protected ObjectFactory of = new ObjectFactory();
- public InfoboxReadRequestType createInfoboxReadRequest() {
+ public InfoboxReadRequestType createInfoboxReadRequest(SignParameter parameter) {
InfoboxReadRequestType request = new InfoboxReadRequestType();
request.setInfoboxIdentifier("Certificates");
InfoboxReadParamsAssocArrayType readData = new InfoboxReadParamsAssocArrayType();
@@ -73,7 +74,7 @@ public abstract class BaseSLConnector implements ISLConnector {
return request;
}
- public RequestPackage createCMSRequest(byte[] signatureData, int[] byteRange)
+ public RequestPackage createCMSRequest(byte[] signatureData, int[] byteRange, SignParameter parameter)
throws PDFIOException {
//if (base64) {
byte[] data = PDFUtils.blackOutSignature(signatureData, byteRange);
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/ISLConnector.java b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/ISLConnector.java
index 120f2f73..1a2f8f79 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/ISLConnector.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/ISLConnector.java
@@ -25,14 +25,15 @@ package at.gv.egiz.sl.util;
import at.gv.egiz.pdfas.common.exceptions.PDFIOException;
import at.gv.egiz.pdfas.common.exceptions.PdfAsException;
+import at.gv.egiz.pdfas.lib.api.sign.SignParameter;
import at.gv.egiz.sl.schema.CreateCMSSignatureResponseType;
import at.gv.egiz.sl.schema.InfoboxReadRequestType;
import at.gv.egiz.sl.schema.InfoboxReadResponseType;
public interface ISLConnector {
- public InfoboxReadRequestType createInfoboxReadRequest();
- public InfoboxReadResponseType sendInfoboxReadRequest(InfoboxReadRequestType request) throws PdfAsException;
- public RequestPackage createCMSRequest(byte[] signatureData, int[] byteRange) throws PDFIOException;
- public CreateCMSSignatureResponseType sendCMSRequest(RequestPackage pack) throws PdfAsException;
+ public InfoboxReadRequestType createInfoboxReadRequest(SignParameter parameter);
+ public InfoboxReadResponseType sendInfoboxReadRequest(InfoboxReadRequestType request, SignParameter parameter) throws PdfAsException;
+ public RequestPackage createCMSRequest(byte[] signatureData, int[] byteRange, SignParameter parameter) throws PDFIOException;
+ public CreateCMSSignatureResponseType sendCMSRequest(RequestPackage pack, SignParameter parameter) throws PdfAsException;
}
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/ISignatureConnector.java b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/ISignatureConnector.java
index e39398a6..fdb95f49 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/ISignatureConnector.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/ISignatureConnector.java
@@ -25,8 +25,9 @@ package at.gv.egiz.sl.util;
import iaik.x509.X509Certificate;
import at.gv.egiz.pdfas.common.exceptions.PdfAsException;
+import at.gv.egiz.pdfas.lib.api.sign.SignParameter;
public interface ISignatureConnector {
- public X509Certificate getCertificate() throws PdfAsException;
- public byte[] sign(byte[] input, int[] byteRange) throws PdfAsException;
+ public X509Certificate getCertificate(SignParameter parameter) throws PdfAsException;
+ public byte[] sign(byte[] input, int[] byteRange, SignParameter parameter) throws PdfAsException;
}
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/ISignatureConnectorSLWrapper.java b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/ISignatureConnectorSLWrapper.java
index 1b9fad2a..b564c215 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/ISignatureConnectorSLWrapper.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/ISignatureConnectorSLWrapper.java
@@ -39,6 +39,7 @@ import org.slf4j.LoggerFactory;
import at.gv.egiz.pdfas.common.exceptions.PdfAsException;
import at.gv.egiz.pdfas.common.exceptions.PdfAsSignatureException;
+import at.gv.egiz.pdfas.lib.api.sign.SignParameter;
import at.gv.egiz.pdfas.lib.impl.verify.VerifyResultImpl;
import at.gv.egiz.sl.schema.CreateCMSSignatureResponseType;
import at.gv.egiz.sl.schema.InfoboxAssocArrayPairType;
@@ -58,13 +59,13 @@ public class ISignatureConnectorSLWrapper implements ISignatureConnector {
this.connector = connector;
}
- public X509Certificate getCertificate() throws PdfAsException {
+ public X509Certificate getCertificate(SignParameter parameter) throws PdfAsException {
X509Certificate certificate = null;
try {
InfoboxReadRequestType request = connector
- .createInfoboxReadRequest();
+ .createInfoboxReadRequest(parameter);
InfoboxReadResponseType response = connector
- .sendInfoboxReadRequest(request);
+ .sendInfoboxReadRequest(request, parameter);
Iterator<InfoboxAssocArrayPairType> iterator = response
.getAssocArrayData().getPair().iterator();
@@ -83,11 +84,11 @@ public class ISignatureConnectorSLWrapper implements ISignatureConnector {
return certificate;
}
- public byte[] sign(byte[] input, int[] byteRange) throws PdfAsException {
+ public byte[] sign(byte[] input, int[] byteRange, SignParameter parameter) throws PdfAsException {
RequestPackage pack = connector.createCMSRequest(
- input, byteRange);
+ input, byteRange, parameter);
CreateCMSSignatureResponseType response = connector
- .sendCMSRequest(pack);
+ .sendCMSRequest(pack, parameter);
try {
SignedData signedData = new SignedData(new ByteArrayInputStream(
response.getCMSSignature()));
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/MOAConnector.java b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/MOAConnector.java
index 9c5c720a..73de30cf 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/MOAConnector.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/MOAConnector.java
@@ -58,6 +58,7 @@ import at.gv.egiz.pdfas.common.exceptions.PdfAsMOAException;
import at.gv.egiz.pdfas.common.exceptions.PdfAsWrappedIOException;
import at.gv.egiz.pdfas.common.settings.ISettings;
import at.gv.egiz.pdfas.lib.api.Configuration;
+import at.gv.egiz.pdfas.lib.api.sign.SignParameter;
public class MOAConnector implements ISignatureConnector {
@@ -125,7 +126,7 @@ public class MOAConnector implements ISignatureConnector {
this.keyIdentifier = config.getValue(MOA_SIGN_KEY_ID);
}
- public X509Certificate getCertificate() throws PdfAsException {
+ public X509Certificate getCertificate(SignParameter parameter) throws PdfAsException {
return this.certificate;
}
@@ -134,7 +135,7 @@ public class MOAConnector implements ISignatureConnector {
return builder.build();
}
- public byte[] sign(byte[] input, int[] byteRange) throws PdfAsException {
+ public byte[] sign(byte[] input, int[] byteRange, SignParameter parameter) throws PdfAsException {
CloseableHttpClient client = null;
try {
client = buildHttpClient();
diff --git a/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSigner.java b/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSigner.java
index 7c6269e0..67b17783 100644
--- a/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSigner.java
+++ b/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSigner.java
@@ -29,6 +29,7 @@ import org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature;
import at.gv.egiz.pdfas.common.exceptions.PdfAsException;
import at.gv.egiz.pdfas.lib.api.sign.IPlainSigner;
+import at.gv.egiz.pdfas.lib.api.sign.SignParameter;
import at.gv.egiz.sl.util.ISignatureConnector;
import at.gv.egiz.sl.util.ISignatureConnectorSLWrapper;
import at.gv.egiz.sl.util.ISLConnector;
@@ -45,12 +46,12 @@ public class PAdESSigner implements IPlainSigner {
this.plainSigner = signer;
}
- public X509Certificate getCertificate() throws PdfAsException {
- return this.plainSigner.getCertificate();
+ public X509Certificate getCertificate(SignParameter parameter) throws PdfAsException {
+ return this.plainSigner.getCertificate(parameter);
}
- public byte[] sign(byte[] input, int[] byteRange) throws PdfAsException {
- return this.plainSigner.sign(input, byteRange);
+ public byte[] sign(byte[] input, int[] byteRange, SignParameter parameter) throws PdfAsException {
+ return this.plainSigner.sign(input, byteRange, parameter);
}
public String getPDFSubFilter() {
diff --git a/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java b/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java
index f0eedb61..7f62b294 100644
--- a/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java
+++ b/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java
@@ -58,6 +58,7 @@ import org.slf4j.LoggerFactory;
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;
+import at.gv.egiz.pdfas.lib.api.sign.SignParameter;
import at.gv.egiz.pdfas.lib.util.CertificateUtils;
public class PAdESSignerKeystore implements IPlainSigner {
@@ -81,7 +82,7 @@ public class PAdESSignerKeystore implements IPlainSigner {
}
}
- public X509Certificate getCertificate() {
+ public X509Certificate getCertificate(SignParameter parameter) {
return cert;
}
@@ -133,7 +134,7 @@ public class PAdESSignerKeystore implements IPlainSigner {
signerInfo.setSignedAttributes(attributeArray);
}
- public byte[] sign(byte[] input, int[] byteRange) throws PdfAsException {
+ public byte[] sign(byte[] input, int[] byteRange, SignParameter parameter) throws PdfAsException {
try {
logger.info("Creating PAdES signature.");
IssuerAndSerialNumber issuer = new IssuerAndSerialNumber(cert);
diff --git a/signature-standards/sigs-pkcs7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedSigner.java b/signature-standards/sigs-pkcs7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedSigner.java
index 62839ea6..802b7590 100644
--- a/signature-standards/sigs-pkcs7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedSigner.java
+++ b/signature-standards/sigs-pkcs7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedSigner.java
@@ -50,6 +50,7 @@ import org.slf4j.LoggerFactory;
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;
+import at.gv.egiz.pdfas.lib.api.sign.SignParameter;
/**
* Creates a PKCS7 detached PDF signature
@@ -75,11 +76,11 @@ public class PKCS7DetachedSigner implements IPlainSigner {
}
}
- public X509Certificate getCertificate() {
+ public X509Certificate getCertificate(SignParameter parameter) {
return cert;
}
- public byte[] sign(byte[] input, int[] byteRange) throws PdfAsException {
+ public byte[] sign(byte[] input, int[] byteRange, SignParameter parameter) throws PdfAsException {
try {
logger.info("Creating PKCS7 signature.");
IssuerAndSerialNumber issuer = new IssuerAndSerialNumber(cert);