summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Heher <jakob.heher@iaik.tugraz.at>2022-08-02 15:05:00 +0200
committerJakob Heher <jakob.heher@iaik.tugraz.at>2022-08-02 15:05:00 +0200
commit464e7b1df6a0ff5d1450e5ff0f67101640edbc5e (patch)
tree7e04c408095bc32aec47ed9a4debfd08e1b64a92
parent832cf5d3353a5fef867d177b32681b1295497626 (diff)
downloadpdf-over-464e7b1df6a0ff5d1450e5ff0f67101640edbc5e.tar.gz
pdf-over-464e7b1df6a0ff5d1450e5ff0f67101640edbc5e.tar.bz2
pdf-over-464e7b1df6a0ff5d1450e5ff0f67101640edbc5e.zip
YAGNI: SignResult interface
-rw-r--r--pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignResult.java45
-rw-r--r--pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignResultImpl.java68
-rw-r--r--pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java3
3 files changed, 35 insertions, 81 deletions
diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignResult.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignResult.java
index 9f9b591c..91bce421 100644
--- a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignResult.java
+++ b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignResult.java
@@ -15,28 +15,51 @@
*/
package at.asit.pdfover.signator;
+//Imports
import java.security.cert.X509Certificate;
/**
- * Signature Result containing the signed document as document source
+ * The result of a signature operation
*/
-public interface SignResult {
+public class SignResult {
+
+ private SignaturePosition position;
+ private DocumentSource source;
+ private X509Certificate certificate;
+
+ public SignaturePosition getSignaturePosition() {
+ return this.position;
+ }
+
+ public DocumentSource getSignedDocument() {
+ return this.source;
+ }
+
+ public X509Certificate getSignerCertificate() {
+ return this.certificate;
+ }
/**
- * Getter of the property <tt>signaturePosition</tt>
- * @return Returns the signaturePosition.
+ * Set the signer certificate
+ * @param x509Certificate the signer certificate
*/
- public SignaturePosition getSignaturePosition();
+ public void setSignerCertificate(X509Certificate x509Certificate) {
+ this.certificate = x509Certificate;
+ }
/**
- * Gets the signed Document
- * @return Returns the documentSource.
+ * Set the signature position
+ * @param postion the signature position
*/
- public DocumentSource getSignedDocument();
+ public void setSignaturePosition(SignaturePosition postion) {
+ this.position = postion;
+ }
/**
- * Gets the signer certificate
- * @return The signer x509 certificate
+ * Set the signed document
+ * @param source DocumentSource containing the signed document
*/
- public X509Certificate getSignerCertificate();
+ public void setSignedDocument(DocumentSource source) {
+ this.source = source;
+ }
}
diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignResultImpl.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignResultImpl.java
deleted file mode 100644
index 35620110..00000000
--- a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignResultImpl.java
+++ /dev/null
@@ -1,68 +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;
-
-//Imports
-import java.security.cert.X509Certificate;
-
-/**
- * The result of a signature operation
- */
-public class SignResultImpl implements SignResult {
-
- private SignaturePosition position;
- private DocumentSource source;
- private X509Certificate certificate;
-
- @Override
- public SignaturePosition getSignaturePosition() {
- return this.position;
- }
-
- @Override
- public DocumentSource getSignedDocument() {
- return this.source;
- }
-
- @Override
- public X509Certificate getSignerCertificate() {
- return this.certificate;
- }
-
- /**
- * Set the signer certificate
- * @param x509Certificate the signer certificate
- */
- public void setSignerCertificate(X509Certificate x509Certificate) {
- this.certificate = x509Certificate;
- }
-
- /**
- * Set the signature position
- * @param postion the signature position
- */
- public void setSignaturePosition(SignaturePosition postion) {
- this.position = postion;
- }
-
- /**
- * Set the signed document
- * @param source DocumentSource containing the signed document
- */
- public void setSignedDocument(DocumentSource source) {
- this.source = source;
- }
-}
diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java
index 5993a3a9..8a31f101 100644
--- a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java
+++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java
@@ -8,7 +8,6 @@ import javax.activation.DataSource;
import at.asit.pdfover.commons.Profile;
import at.asit.pdfover.signator.ByteArrayDocumentSource;
import at.asit.pdfover.signator.SignResult;
-import at.asit.pdfover.signator.SignResultImpl;
import at.asit.pdfover.signator.SignatureException;
import at.asit.pdfover.signator.SignaturePosition;
import at.gv.egiz.pdfas.common.exceptions.PDFASError;
@@ -114,7 +113,7 @@ public class PdfAs4Signer {
pdfas.sign(param);
- SignResultImpl result = new SignResultImpl();
+ SignResult result = new SignResult();
if (param.getSignaturePosition() != null) {
TablePos tp = new TablePos(param.getSignaturePosition());