From 464e7b1df6a0ff5d1450e5ff0f67101640edbc5e Mon Sep 17 00:00:00 2001 From: Jakob Heher Date: Tue, 2 Aug 2022 15:05:00 +0200 Subject: YAGNI: SignResult interface --- .../java/at/asit/pdfover/signator/SignResult.java | 45 ++++++++++---- .../at/asit/pdfover/signator/SignResultImpl.java | 68 ---------------------- 2 files changed, 34 insertions(+), 79 deletions(-) delete mode 100644 pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignResultImpl.java (limited to 'pdf-over-signator') 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 signaturePosition - * @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; - } -} -- cgit v1.2.3