aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-common
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@iaik.tugraz.at>2023-01-12 12:26:00 +0000
committerThomas Lenz <thomas.lenz@iaik.tugraz.at>2023-01-12 12:26:00 +0000
commitab328e055e01b12a91c8ccee4ac0cbea3e0fb282 (patch)
treee0c57f79dc1a57d3f6c4e3af1d982b750bad96f9 /pdf-as-common
parent74668d9f7e8cfb9c729e804067984d0f5e731f2f (diff)
parente78fccac558a93f18bae96ddb6c8e131afaf946d (diff)
downloadpdf-as-4-ab328e055e01b12a91c8ccee4ac0cbea3e0fb282.tar.gz
pdf-as-4-ab328e055e01b12a91c8ccee4ac0cbea3e0fb282.tar.bz2
pdf-as-4-ab328e055e01b12a91c8ccee4ac0cbea3e0fb282.zip
Merge branch 'development' into 'feature/issue_73'
# Conflicts: # build.gradle # pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java
Diffstat (limited to 'pdf-as-common')
-rw-r--r--pdf-as-common/build.gradle4
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/CoreSignParams.java32
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/DocumentToSign.java22
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/PdfasSignRequest.java62
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/PdfasSignResponse.java23
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/SignedDocument.java25
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSignParameters.java14
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSigning.java10
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasGetMultipleRequest.java24
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignDocument.java37
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignMultipleRequest.java60
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignMultipleResponse.java35
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignedDocument.java30
13 files changed, 372 insertions, 6 deletions
diff --git a/pdf-as-common/build.gradle b/pdf-as-common/build.gradle
index b57f9b6f..2af41031 100644
--- a/pdf-as-common/build.gradle
+++ b/pdf-as-common/build.gradle
@@ -22,8 +22,8 @@ releases.dependsOn sourcesJar
dependencies {
api group: 'org.slf4j', name: 'slf4j-api', version: slf4jVersion
api group: 'commons-collections', name: 'commons-collections', version: '3.2.2'
- api group: 'commons-io', name: 'commons-io', version: '2.8.0'
- api group: 'ognl', name: 'ognl', version: '3.2.19'
+ api group: 'commons-io', name: 'commons-io', version: '2.11.0'
+ api group: 'ognl', name: 'ognl', version: '3.3.4'
api group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1'
api 'commons-codec:commons-codec:1.15'
api group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '2.3.3'
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/CoreSignParams.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/CoreSignParams.java
new file mode 100644
index 00000000..f86e93b6
--- /dev/null
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/CoreSignParams.java
@@ -0,0 +1,32 @@
+package at.gv.egiz.pdfas.api.processing;
+
+import java.io.Serializable;
+import java.util.Map;
+
+import at.gv.egiz.pdfas.api.ws.PDFASSignParameters.Connector;
+import lombok.Data;
+
+@Data
+public class CoreSignParams implements Serializable {
+
+ private static final long serialVersionUID = 947480605651880556L;
+
+ String transactionId;
+
+ Connector connector;
+
+ String invokeUrl;
+
+ String invokeTarget;
+
+ String invokeErrorUrl;
+
+ String keyIdentifier;
+
+ Map<String,String> preprocessor;
+
+ Map<String,String> overrides;
+
+ Map<String,String> signatureBlockParameters;
+
+}
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/DocumentToSign.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/DocumentToSign.java
new file mode 100644
index 00000000..6cc3a933
--- /dev/null
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/DocumentToSign.java
@@ -0,0 +1,22 @@
+package at.gv.egiz.pdfas.api.processing;
+
+import java.io.Serializable;
+
+import lombok.Data;
+
+@Data
+public class DocumentToSign implements Serializable {
+
+ private static final long serialVersionUID = 551977730667465367L;
+
+ byte[] inputData;
+
+ String fileName;
+
+ String position;
+
+ String qrCodeContent;
+
+ String profile;
+
+}
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/PdfasSignRequest.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/PdfasSignRequest.java
new file mode 100644
index 00000000..b36b5a4c
--- /dev/null
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/PdfasSignRequest.java
@@ -0,0 +1,62 @@
+package at.gv.egiz.pdfas.api.processing;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import at.gv.egiz.pdfas.api.ws.VerificationLevel;
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+public class PdfasSignRequest implements Serializable, Iterator<DocumentToSign> {
+
+ private static final long serialVersionUID = -7245405996920651806L;
+
+ @Setter
+ String requestID;
+
+ @Setter
+ CoreSignParams coreParams;
+
+ @Setter
+ VerificationLevel verificationLevel;
+
+ List<DocumentToSign> input;
+
+ /**
+ * Add single PDF for signing.
+ *
+ * @param pdf PDF to sign
+ */
+ public void addDocumentToSign(DocumentToSign pdf) {
+ if (input == null) {
+ input = new ArrayList<>();
+
+ }
+ input.add(pdf);
+
+ }
+
+
+ /**
+ * <code>true</code> if there is one or more {@link DocumentToSign}, otherwise <code>false</code>.
+ */
+ @Override
+ public boolean hasNext() {
+ return input != null && !input.isEmpty();
+
+ }
+
+ /**
+ * Get next {@link DocumentToSign}.
+ */
+ @Override
+ public synchronized DocumentToSign next() {
+ return input.remove(0);
+
+ }
+
+
+}
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/PdfasSignResponse.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/PdfasSignResponse.java
new file mode 100644
index 00000000..3618715f
--- /dev/null
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/PdfasSignResponse.java
@@ -0,0 +1,23 @@
+package at.gv.egiz.pdfas.api.processing;
+
+import java.io.Serializable;
+import java.util.List;
+
+import lombok.Builder;
+import lombok.Data;
+import lombok.Singular;
+
+@Data
+@Builder(toBuilder = true)
+public class PdfasSignResponse implements Serializable {
+
+ private static final long serialVersionUID = -3235466827933651452L;
+
+ String requestId;
+
+ String transactionId;
+
+ @Singular
+ List<SignedDocument> signedPdfs;
+
+}
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/SignedDocument.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/SignedDocument.java
new file mode 100644
index 00000000..348746df
--- /dev/null
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/SignedDocument.java
@@ -0,0 +1,25 @@
+package at.gv.egiz.pdfas.api.processing;
+
+import java.io.Serializable;
+
+import at.gv.egiz.pdfas.api.ws.PDFASVerificationResponse;
+import lombok.Builder;
+import lombok.Data;
+
+@Data
+@Builder
+public class SignedDocument implements Serializable {
+
+ private static final long serialVersionUID = 5409915106152807937L;
+
+ Long signingTimestamp;
+
+ byte[] outputData;
+
+ String fileName;
+
+ String signerCertificate;
+
+ PDFASVerificationResponse verificationResponse;
+
+}
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSignParameters.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSignParameters.java
index 94906112..a70b8f56 100644
--- a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSignParameters.java
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSignParameters.java
@@ -23,11 +23,8 @@
******************************************************************************/
package at.gv.egiz.pdfas.api.ws;
-import at.gv.egiz.pdfas.common.settings.SignatureProfileSettings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import java.io.Serializable;
+import java.util.Arrays;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlEnumValue;
@@ -71,6 +68,15 @@ public class PDFASSignParameters implements Serializable {
public String toString(){
return name;
}
+
+ public static Connector fromString(String value) {
+ return Arrays.asList(Connector.values()).stream()
+ .filter(el -> el.toString().equalsIgnoreCase(value))
+ .findFirst()
+ .get();
+
+ }
+
}
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSigning.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSigning.java
index 667080fa..beeff937 100644
--- a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSigning.java
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSigning.java
@@ -44,4 +44,14 @@ public interface PDFASSigning {
@WebMethod(operationName = "signBulk")
@WebResult(name="bulkResponse")
public PDFASBulkSignResponse signPDFDokument(@WebParam(name = "signBulkRequest") PDFASBulkSignRequest request);
+
+ @WebMethod(operationName = "signMultiple")
+ @WebResult(name="signMultipleResponse")
+ public PdfasSignMultipleResponse signPDFDokument(@WebParam(name = "signMultipleRequest") PdfasSignMultipleRequest request);
+
+ @WebMethod(operationName = "getMultiple")
+ @WebResult(name="getMultipleResponse")
+ public PdfasSignMultipleResponse getSignedDokument(@WebParam(name = "getMultipleRequest") PdfasGetMultipleRequest request);
+
+
}
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasGetMultipleRequest.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasGetMultipleRequest.java
new file mode 100644
index 00000000..5f4f3a27
--- /dev/null
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasGetMultipleRequest.java
@@ -0,0 +1,24 @@
+package at.gv.egiz.pdfas.api.ws;
+
+import java.io.Serializable;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+@XmlType(name="getMultipleRequest")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class PdfasGetMultipleRequest implements Serializable {
+
+ private static final long serialVersionUID = -7105371679206044280L;
+
+ @XmlElement(required = true, nillable = false, name="token")
+ String token;
+
+}
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignDocument.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignDocument.java
new file mode 100644
index 00000000..e065ef5e
--- /dev/null
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignDocument.java
@@ -0,0 +1,37 @@
+package at.gv.egiz.pdfas.api.ws;
+
+import java.io.Serializable;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+@XmlType(name="signMultipleFile")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class PdfasSignDocument implements Serializable {
+
+ private static final long serialVersionUID = -2422995343468207094L;
+
+ @XmlElement(required = true, nillable = false, name="inputData")
+ byte[] inputData;
+
+ @XmlElement(required = true, nillable = false, name="fileName")
+ String fileName;
+
+ @XmlElement(required = false, nillable = true, name="position")
+ String position;
+
+ @XmlElement(required = false, nillable = true, name="qrCodeContent")
+ String qrCodeContent;
+
+ @XmlElement(required = false, nillable = true, name="profile")
+ String profile;
+
+}
+
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignMultipleRequest.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignMultipleRequest.java
new file mode 100644
index 00000000..8d172bfb
--- /dev/null
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignMultipleRequest.java
@@ -0,0 +1,60 @@
+package at.gv.egiz.pdfas.api.ws;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import at.gv.egiz.pdfas.api.ws.PDFASSignParameters.Connector;
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+@XmlType(name="signMultipleRequest")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class PdfasSignMultipleRequest implements Serializable {
+
+ private static final long serialVersionUID = 4338536417988335976L;
+
+ @XmlElement(required = true, nillable = false, name="requestID")
+ String requestID;
+
+ @XmlElement(required = false, nillable = true, name="transactionId")
+ String transactionId;
+
+ @XmlElement(required = true, nillable = false, name="connector")
+ Connector connector;
+
+ @XmlElement(required = false, nillable = true, name="invoke-url")
+ String invokeUrl;
+
+ @XmlElement(required = false, nillable = true, name="invoke-target")
+ String invokeTarget;
+
+ @XmlElement(required = false, nillable = true, name="invoke-error-url")
+ String invokeErrorUrl;
+
+ @XmlElement(required = false, nillable = true, name="keyIdentifier")
+ String keyIdentifier;
+
+ @XmlElement(required = false, nillable = true, name="preprocessorArguments")
+ PDFASPropertyMap preprocessor;
+
+ @XmlElement(required = false, nillable = true, name="configurationOverrides")
+ PDFASPropertyMap overrides;
+
+ @XmlElement(required = false, nillable = true, name="signatureBlockParameter")
+ Map<String,String> signatureBlockParameters;
+
+ @XmlElement(required = false, nillable = true, name="verificationLevel")
+ VerificationLevel verificationLevel;
+
+ @XmlElement(required = true, nillable = false, name="documents")
+ List<PdfasSignDocument> input;
+
+}
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignMultipleResponse.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignMultipleResponse.java
new file mode 100644
index 00000000..a2391d11
--- /dev/null
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignMultipleResponse.java
@@ -0,0 +1,35 @@
+package at.gv.egiz.pdfas.api.ws;
+
+import java.io.Serializable;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+@XmlType(name="signMultipleResponse")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class PdfasSignMultipleResponse implements Serializable {
+ private static final long serialVersionUID = 2544165926674778203L;
+
+ @XmlElement(required = true, nillable = false, name="requestID")
+ String requestID;
+
+ @XmlElement(required = false, nillable = true, name="transactionId")
+ String transactionId;
+
+ @XmlElement(required = false, name="error")
+ String error;
+
+ @XmlElement(required = false, name="redirectUrl")
+ String redirectUrl;
+
+ @XmlElement(required = true, nillable = false, name="documents")
+ List<PdfasSignedDocument> output;
+}
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignedDocument.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignedDocument.java
new file mode 100644
index 00000000..7ac13e1d
--- /dev/null
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignedDocument.java
@@ -0,0 +1,30 @@
+package at.gv.egiz.pdfas.api.ws;
+
+import java.io.Serializable;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+@XmlType(name="signedMultipleFile")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class PdfasSignedDocument implements Serializable {
+
+ private static final long serialVersionUID = -2621030544869357960L;
+
+ @XmlElement(required = true, nillable = false, name="outputData")
+ byte[] outputData;
+
+ @XmlElement(required = false, nillable = true, name="fileName")
+ String fileName;
+
+ @XmlElement(required = false, nillable = false, name="verificationResponse")
+ PDFASVerificationResponse verificationResponse;
+
+}