summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Heher <jakob.heher@iaik.tugraz.at>2022-09-30 14:03:38 +0200
committerJakob Heher <jakob.heher@iaik.tugraz.at>2022-09-30 14:03:38 +0200
commit96ba5fe6185cfdeb326ae3148ce88f299e41ef25 (patch)
treec166322699389afebf495a919f3529eea1918a2c
parentf5d1de1e0bd56b2c61953b1688e53b6efe249ddb (diff)
downloadpdf-over-96ba5fe6185cfdeb326ae3148ce88f299e41ef25.tar.gz
pdf-over-96ba5fe6185cfdeb326ae3148ce88f299e41ef25.tar.bz2
pdf-over-96ba5fe6185cfdeb326ae3148ce88f299e41ef25.zip
YAGNI: SLRequest abstraction
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/LocalBKUConnector.java4
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java4
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java4
-rw-r--r--pdf-over-signator/src/main/java/at/asit/pdfover/signator/BkuSlConnector.java2
-rw-r--r--pdf-over-signator/src/main/java/at/asit/pdfover/signator/SLRequest.java67
-rw-r--r--pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SLRequest.java22
-rw-r--r--pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SigningState.java3
7 files changed, 19 insertions, 87 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/LocalBKUConnector.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/LocalBKUConnector.java
index 2993ea55..5aeea741 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/LocalBKUConnector.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/LocalBKUConnector.java
@@ -33,8 +33,8 @@ import org.slf4j.LoggerFactory;
import at.asit.pdfover.commons.Constants;
import at.asit.pdfover.gui.utils.FileUploadSource;
import at.asit.pdfover.signator.BkuSlConnector;
-import at.asit.pdfover.signator.SLRequest;
import at.asit.pdfover.signator.SignatureException;
+import at.asit.pdfover.signer.pdfas.PdfAs4SLRequest;
/**
*
@@ -64,7 +64,7 @@ public class LocalBKUConnector implements BkuSlConnector {
* @see at.asit.pdfover.signator.BkuSlConnector#handleSLRequest(java.lang.String)
*/
@Override
- public String handleSLRequest(SLRequest request) throws SignatureException {
+ public String handleSLRequest(PdfAs4SLRequest request) throws SignatureException {
try {
HttpClient client = BKUHelper.getHttpClient();
PostMethod method = new PostMethod(Constants.LOCAL_BKU_URL);
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java
index 0ee258f3..2fa5a8e5 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java
@@ -24,8 +24,8 @@ import at.asit.pdfover.gui.bku.mobile.ATrustHandler;
import at.asit.pdfover.gui.bku.mobile.ATrustStatus;
import at.asit.pdfover.gui.workflow.states.MobileBKUState;
import at.asit.pdfover.signator.BkuSlConnector;
-import at.asit.pdfover.signator.SLRequest;
import at.asit.pdfover.signator.SignatureException;
+import at.asit.pdfover.signer.pdfas.PdfAs4SLRequest;
import at.asit.pdfover.signer.pdfas.PdfAs4SigningState;
/**
@@ -51,7 +51,7 @@ public class MobileBKUConnector implements BkuSlConnector {
* @see at.asit.pdfover.signator.BkuSlConnector#handleSLRequest(java.lang.String)
*/
@Override
- public String handleSLRequest(SLRequest request) throws SignatureException {
+ public String handleSLRequest(PdfAs4SLRequest request) throws SignatureException {
PdfAs4SigningState signingState = this.state.getSigningState();
signingState.signatureRequest = request;
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java
index abcc1e19..e639323d 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java
@@ -60,7 +60,7 @@ import at.asit.pdfover.gui.utils.FileUploadSource;
import at.asit.pdfover.commons.Messages;
import at.asit.pdfover.gui.workflow.states.LocalBKUState;
import at.asit.pdfover.gui.workflow.states.MobileBKUState;
-import at.asit.pdfover.signator.SLRequest;
+import at.asit.pdfover.signer.pdfas.PdfAs4SLRequest;
import at.asit.pdfover.signer.pdfas.PdfAs4SigningState;
/**
@@ -287,7 +287,7 @@ public class ATrustHandler {
* @return the response
* @throws IOException IO error
*/
- public String postSLRequest(String mobileBKUUrl, SLRequest request) throws IOException {
+ public String postSLRequest(String mobileBKUUrl, PdfAs4SLRequest request) throws IOException {
MobileBKUHelper.registerTrustedSocketFactory();
HttpClient client = MobileBKUHelper.getHttpClient(getStatus());
diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/BkuSlConnector.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/BkuSlConnector.java
index a4f7213b..002c457c 100644
--- a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/BkuSlConnector.java
+++ b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/BkuSlConnector.java
@@ -26,5 +26,5 @@ public interface BkuSlConnector {
* @return SL Response
* @throws SignatureException
*/
- public String handleSLRequest(SLRequest request) throws SignatureException;
+ public String handleSLRequest(PdfAs4SLRequest request) throws SignatureException;
}
diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SLRequest.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SLRequest.java
deleted file mode 100644
index 95aee1e0..00000000
--- a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SLRequest.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright 2012 by A-SIT, Secure Information Technology Center Austria
- *
- * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
- * http://joinup.ec.europa.eu/software/page/eupl
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- */
-package at.asit.pdfover.signator;
-
-/**
- * Security Layer Request
- */
-public class SLRequest {
-
- /**
- * The security layer request
- */
- private String request;
-
- /**
- * The document to be signed
- */
- private DocumentSource signatureData;
-
- /**
- * Set the SL request
- * @param request the request to set
- */
- protected void setRequest(String request) {
- this.request = request;
- }
-
- /**
- * Set the signature data (document to be signed)
- * @param signatureData the signatureData to set
- */
- protected void setSignatureData(DocumentSource signatureData) {
- this.signatureData = signatureData;
- }
-
- /**
- * Gets the signature data for this request
- *
- * @return The document source
- */
- public DocumentSource getSignatureData()
- {
- return this.signatureData;
- }
-
- /**
- * Gets the request String
- *
- * @return the request
- */
- public String getRequest() {
- return this.request;
- }
-}
diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SLRequest.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SLRequest.java
index 87b97ac9..20c919f2 100644
--- a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SLRequest.java
+++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SLRequest.java
@@ -16,23 +16,23 @@
package at.asit.pdfover.signer.pdfas;
// Imports
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import at.asit.pdfover.signator.ByteArrayDocumentSource;
-import at.asit.pdfover.signator.SLRequest;
import at.asit.pdfover.signer.pdfas.exceptions.PdfAs4SLRequestException;
/**
* PDF - AS Security Layer Request implementation
*/
-public class PdfAs4SLRequest extends SLRequest {
+public class PdfAs4SLRequest {
/**
- * SLF4J Logger instance
- **/
- @SuppressWarnings("unused")
- private static final Logger log = LoggerFactory.getLogger(PdfAs4SLRequest.class);
+ * The security layer request
+ */
+ public final String request;
+
+ /**
+ * The document to be signed
+ */
+ public final ByteArrayDocumentSource signatureData;
/**
* Default constructor
@@ -41,7 +41,7 @@ public class PdfAs4SLRequest extends SLRequest {
* @throws PdfAs4SLRequestException
*/
public PdfAs4SLRequest(String slRequest, byte[] signData) throws PdfAs4SLRequestException {
- setRequest(slRequest);
- setSignatureData(signData == null ? null : new ByteArrayDocumentSource(signData));
+ this.request = slRequest;
+ this.signatureData = (signData == null ? null : new ByteArrayDocumentSource(signData));
}
}
diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SigningState.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SigningState.java
index 5312e582..2192f380 100644
--- a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SigningState.java
+++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SigningState.java
@@ -19,7 +19,6 @@ package at.asit.pdfover.signer.pdfas;
import java.io.ByteArrayOutputStream;
import at.asit.pdfover.signator.BkuSlConnector;
-import at.asit.pdfover.signator.SLRequest;
import at.asit.pdfover.signator.SignatureException;
import at.gv.egiz.pdfas.common.exceptions.PDFASError;
import at.gv.egiz.pdfas.lib.api.sign.IPlainSigner;
@@ -34,7 +33,7 @@ public class PdfAs4SigningState {
/**
* The Signature Layer request
*/
- public SLRequest signatureRequest;
+ public PdfAs4SLRequest signatureRequest;
/**
* The Signature Layer response