From de166b5e111aab5ad53cae2bda440e9c17434d98 Mon Sep 17 00:00:00 2001 From: tkellner Date: Wed, 10 Apr 2013 18:49:29 +0000 Subject: PDFSignerInterface update PDFSignatorInterface created PDFSignator Project created git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@4 174cde9d-5d70-4d2a-aa98-46368bc2aaf7 --- pdf-over/pdf-signator-interface/pom.xml | 17 + .../pdfover/pdfsignator/PDFSignatorInterface.java | 39 + .../at/asit/pdfover/pdfsignator/PDFSigner.java | 16 + .../asit/pdfover/pdfsignator/SignedDocument.java | 13 + .../src/model/PDFSignatorInterface.ucd | 36 + .../src/model/SignatureSequence.usd | 216 +++++ pdf-over/pdf-signator/pom.xml | 10 + .../asit/pdfover/pdfsignator/CollimatingMark.java | 5 - .../asit/pdfover/pdfsignator/DocumentSource.java | 9 - .../pdfover/pdfsignator/PDFSignatureException.java | 14 - .../pdfover/pdfsignator/PDFSignerInterface.java | 38 - .../at/asit/pdfover/pdfsignator/SignResult.java | 28 - .../pdfover/pdfsignator/SignatureDimension.java | 60 -- .../pdfover/pdfsignator/SignatureParameter.java | 106 --- .../pdfover/pdfsignator/SignaturePosition.java | 100 --- .../at/asit/pdfover/pdfsignator/SigningState.java | 26 - .../at/asit/pdfover/pdfsigner/CollimatingMark.java | 5 + .../at/asit/pdfover/pdfsigner/DocumentSource.java | 9 + .../pdfover/pdfsigner/PDFSignatureException.java | 14 + .../asit/pdfover/pdfsigner/PDFSignerInterface.java | 38 + .../java/at/asit/pdfover/pdfsigner/SLRequest.java | 13 + .../java/at/asit/pdfover/pdfsigner/SLResponse.java | 9 + .../java/at/asit/pdfover/pdfsigner/SignResult.java | 28 + .../asit/pdfover/pdfsigner/SignatureDimension.java | 60 ++ .../asit/pdfover/pdfsigner/SignatureParameter.java | 106 +++ .../asit/pdfover/pdfsigner/SignaturePosition.java | 100 +++ .../at/asit/pdfover/pdfsigner/SigningState.java | 20 + .../src/model/PDFSignerInterface.ucd | 269 ++++--- .../src/model/PDFSignerSequenz.usd | 109 +++ .../src/model/images/PDFSignerInterface.svg | 891 +++++++++++++++++++++ pdf-over/pom.xml | 2 + 31 files changed, 1902 insertions(+), 504 deletions(-) create mode 100644 pdf-over/pdf-signator-interface/pom.xml create mode 100644 pdf-over/pdf-signator-interface/src/main/java/at/asit/pdfover/pdfsignator/PDFSignatorInterface.java create mode 100644 pdf-over/pdf-signator-interface/src/main/java/at/asit/pdfover/pdfsignator/PDFSigner.java create mode 100644 pdf-over/pdf-signator-interface/src/main/java/at/asit/pdfover/pdfsignator/SignedDocument.java create mode 100644 pdf-over/pdf-signator-interface/src/model/PDFSignatorInterface.ucd create mode 100644 pdf-over/pdf-signator-interface/src/model/SignatureSequence.usd create mode 100644 pdf-over/pdf-signator/pom.xml delete mode 100644 pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/CollimatingMark.java delete mode 100644 pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/DocumentSource.java delete mode 100644 pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/PDFSignatureException.java delete mode 100644 pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/PDFSignerInterface.java delete mode 100644 pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/SignResult.java delete mode 100644 pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/SignatureDimension.java delete mode 100644 pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/SignatureParameter.java delete mode 100644 pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/SignaturePosition.java delete mode 100644 pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/SigningState.java create mode 100644 pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/CollimatingMark.java create mode 100644 pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/DocumentSource.java create mode 100644 pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/PDFSignatureException.java create mode 100644 pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/PDFSignerInterface.java create mode 100644 pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SLRequest.java create mode 100644 pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SLResponse.java create mode 100644 pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignResult.java create mode 100644 pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignatureDimension.java create mode 100644 pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignatureParameter.java create mode 100644 pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignaturePosition.java create mode 100644 pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SigningState.java create mode 100644 pdf-over/pdf-signer-interface/src/model/PDFSignerSequenz.usd create mode 100644 pdf-over/pdf-signer-interface/src/model/images/PDFSignerInterface.svg diff --git a/pdf-over/pdf-signator-interface/pom.xml b/pdf-over/pdf-signator-interface/pom.xml new file mode 100644 index 00000000..f0985880 --- /dev/null +++ b/pdf-over/pdf-signator-interface/pom.xml @@ -0,0 +1,17 @@ + + 4.0.0 + + pdf-over + at.a-sit + 4.0-SNAPSHOT + .. + + pdf-signator-interface + + + at.a-sit + pdf-signer-interface + 0.1-SNAPSHOT + + + \ No newline at end of file diff --git a/pdf-over/pdf-signator-interface/src/main/java/at/asit/pdfover/pdfsignator/PDFSignatorInterface.java b/pdf-over/pdf-signator-interface/src/main/java/at/asit/pdfover/pdfsignator/PDFSignatorInterface.java new file mode 100644 index 00000000..d75cc536 --- /dev/null +++ b/pdf-over/pdf-signator-interface/src/main/java/at/asit/pdfover/pdfsignator/PDFSignatorInterface.java @@ -0,0 +1,39 @@ +/** + * + */ +package at.asit.pdfover.pdfsignator; + +import at.asit.pdfover.pdfsigner.SignResult; +import at.asit.pdfover.pdfsigner.SignatureParameter; +import at.asit.pdfover.pdfsigner.SLRequest; +import at.asit.pdfover.pdfsigner.SLResponse; +import at.asit.pdfover.pdfsigner.SigningState; + +/** + * The PDF-Signator Interface + * + * @author afitzek + */ +public interface PDFSignatorInterface { + + /** + * Creates signature parameter for the given pdf signer + * @param signer The pdf signer library + * @return The signature parameter + */ + public SignatureParameter GetSignatureParameters(PDFSigner signer); + + /** + * Prepares the signature + * @param parameter The signature parameter + * @return A Signature State for the signing library + */ + public SigningState SignPrepare(SignatureParameter parameter); + + /** + * Performs the signature + * @param response The signing state + * @return The signed document + */ + public SignResult SignPerform(SigningState state); +} diff --git a/pdf-over/pdf-signator-interface/src/main/java/at/asit/pdfover/pdfsignator/PDFSigner.java b/pdf-over/pdf-signator-interface/src/main/java/at/asit/pdfover/pdfsignator/PDFSigner.java new file mode 100644 index 00000000..6d8da945 --- /dev/null +++ b/pdf-over/pdf-signator-interface/src/main/java/at/asit/pdfover/pdfsignator/PDFSigner.java @@ -0,0 +1,16 @@ +/** + * + */ +package at.asit.pdfover.pdfsignator; + +/** + * Available PDF Signer libraries + * @author afitzek + */ +public enum PDFSigner { + /** + * @uml.property name="pDFAS" + * @uml.associationEnd + */ + PDFAS +} diff --git a/pdf-over/pdf-signator-interface/src/main/java/at/asit/pdfover/pdfsignator/SignedDocument.java b/pdf-over/pdf-signator-interface/src/main/java/at/asit/pdfover/pdfsignator/SignedDocument.java new file mode 100644 index 00000000..1c8c28fe --- /dev/null +++ b/pdf-over/pdf-signator-interface/src/main/java/at/asit/pdfover/pdfsignator/SignedDocument.java @@ -0,0 +1,13 @@ +/** + * + */ +package at.asit.pdfover.pdfsignator; + +/** + * Represents a Signed Document + * + * @author afitzek + */ +public class SignedDocument { + +} diff --git a/pdf-over/pdf-signator-interface/src/model/PDFSignatorInterface.ucd b/pdf-over/pdf-signator-interface/src/model/PDFSignatorInterface.ucd new file mode 100644 index 00000000..2ed18b62 --- /dev/null +++ b/pdf-over/pdf-signator-interface/src/model/PDFSignatorInterface.ucd @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pdf-over/pdf-signator-interface/src/model/SignatureSequence.usd b/pdf-over/pdf-signator-interface/src/model/SignatureSequence.usd new file mode 100644 index 00000000..0823809c --- /dev/null +++ b/pdf-over/pdf-signator-interface/src/model/SignatureSequence.usd @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pdf-over/pdf-signator/pom.xml b/pdf-over/pdf-signator/pom.xml new file mode 100644 index 00000000..f66bc3c9 --- /dev/null +++ b/pdf-over/pdf-signator/pom.xml @@ -0,0 +1,10 @@ + + 4.0.0 + + pdf-over + at.a-sit + 4.0-SNAPSHOT + .. + + pdf-signator + \ No newline at end of file diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/CollimatingMark.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/CollimatingMark.java deleted file mode 100644 index 1d209671..00000000 --- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/CollimatingMark.java +++ /dev/null @@ -1,5 +0,0 @@ -package at.asit.pdfover.pdfsignator; - -public class CollimatingMark { - -} diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/DocumentSource.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/DocumentSource.java deleted file mode 100644 index 3550596c..00000000 --- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/DocumentSource.java +++ /dev/null @@ -1,9 +0,0 @@ -package at.asit.pdfover.pdfsignator; - -/** - * A Document Source - * @author afitzek - */ -public class DocumentSource { - -} diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/PDFSignatureException.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/PDFSignatureException.java deleted file mode 100644 index 78e66e01..00000000 --- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/PDFSignatureException.java +++ /dev/null @@ -1,14 +0,0 @@ -package at.asit.pdfover.pdfsignator; - -/** - * base class for signature exceptions - * @author afitzek - */ -public class PDFSignatureException extends Exception { - - /** - * - */ - private static final long serialVersionUID = 711578398780816710L; - -} diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/PDFSignerInterface.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/PDFSignerInterface.java deleted file mode 100644 index e7ceeff6..00000000 --- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/PDFSignerInterface.java +++ /dev/null @@ -1,38 +0,0 @@ -package at.asit.pdfover.pdfsignator; - -import java.security.SignatureException; - -/** - * PDF Signator base Class - * This class should be extended to support PDF-AS and PADES. - * @author afitzek - */ -public interface PDFSignerInterface { - - /** - * Prepare a signature - * Defines signature parameters, the pdf library prepares the pdf document to sign and - * creates a Security Layer Request. - * @param parameter The signature parameters - * @return The siging state (contains the prepared document and the signature request - * @throws SignatureException - */ - public SigningState Prepare(SignatureParameter parameter) throws SignatureException; - - /** - * Adds the signature to the document. - * The SL Response has to be set in the state - * @param state The siging state - * @return The signature Result - * @throws SignatureException - */ - public SignResult Sign(SigningState state) throws SignatureException; - - /** - * Creates new signing profile - * @param base The profile id of the base profile - * @param profileID The id of the new profile - * @return The new Profile - */ - public SignatureParameter GetParameter(); -} diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/SignResult.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/SignResult.java deleted file mode 100644 index 847d9cd5..00000000 --- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/SignResult.java +++ /dev/null @@ -1,28 +0,0 @@ -package at.asit.pdfover.pdfsignator; - -import javax.security.cert.Certificate; - -/** - * Signature Result containing the signed document as document source - * @author afitzek - */ -public interface SignResult { - - /** - * Getter of the property signaturePosition - * @return Returns the signaturePosition. - */ - public SignaturePosition GetSignaturePosition(); - - /** - * Gets the signed Document - * @return Returns the documentSource. - */ - public DocumentSource GetSignedDocument(); - - /** - * Gets the signer certificate - * @return The signer x509 certificate - */ - public Certificate GetSignerCertificate(); -} diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/SignatureDimension.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/SignatureDimension.java deleted file mode 100644 index 5bff2da8..00000000 --- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/SignatureDimension.java +++ /dev/null @@ -1,60 +0,0 @@ -package at.asit.pdfover.pdfsignator; - -/** - * The Dimensions of the visible signature block - * @author afitzek - */ -public class SignatureDimension { - - /** - * The visible Signature block width - */ - protected int width; - - /** - * The visible Signature block height - */ - protected int height; - - /** - * Sets the width for the dimension - * @param value - */ - public void SetWidth(int value) { - this.width = value; - } - - /** - * Constructor - * @param width The width of the signature block - * @param height The height of the signature block - */ - public SignatureDimension(int width, int height) { - this.width = width; - this.height = height; - } - - /** - * Gets the width of the visible Signature block - * @return - */ - public int GetWidth() { - return this.width; - } - - /** - * Sets the height for the dimension - * @param value - */ - public void SetHeight(int value) { - this.height = value; - } - - /** - * Gets the height of the visible Signature block - * @return - */ - public int GetHeight() { - return this.height; - } -} diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/SignatureParameter.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/SignatureParameter.java deleted file mode 100644 index e50b2751..00000000 --- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/SignatureParameter.java +++ /dev/null @@ -1,106 +0,0 @@ -package at.asit.pdfover.pdfsignator; - -/** - * The Signature Parameter - * @author afitzek - */ -public abstract class SignatureParameter { - - /** - * The Signature Position - * @uml.property name="signaturePosition" - * @uml.associationEnd - */ - protected SignaturePosition signaturePosition = null; - - /** - * Getter of the property signaturePosition - * @return Returns the signaturePosition. - */ - public SignaturePosition GetSignaturePosition() { - return signaturePosition; - } - - /** - * Setter of the property signaturePosition - * @param signaturePosition The signaturePosition to set. - */ - public void SetSignaturePosition(SignaturePosition signaturePosition) { - this.signaturePosition = signaturePosition; - } - - /** - * The signature Device - */ - protected String KeyIdentifier = null; - - /** - * Getter of the property KeyIdentifier - * @return Returns the KeyIdentifier. - */ - public String GetKeyIdentifier() { - return KeyIdentifier; - } - - /** - * Setter of the property KeyIdentifier - * @param value The KeyIdentifier to set. - */ - public void SetKeyIdentifier(String value) { - this.KeyIdentifier = value; - } - - /** - * The signature Device - * @uml.property name="documentSource" - * @uml.associationEnd - */ - protected DocumentSource documentSource = null; - - /** - * Getter of the property documentSource - * @return Returns the documentSource. - */ - public DocumentSource GetInputDocument() { - return documentSource; - } - - /** - * Setter of the property documentSource - * @param value The documentSource to set. - */ - public void SetInputDocument(DocumentSource value) { - this.documentSource = value; - } - - /** - * Gets the Dimension to display the Placeholder - * @return the placeholder dimensions - */ - public abstract SignatureDimension GetPlaceholderDimension(); - - /** - * holds the collimating mark - * @uml.property name="collimark" - * @uml.associationEnd - */ - protected CollimatingMark collimark; - - /** - * Gets the collimating mark - * @return - */ - public CollimatingMark GetCollimatingMark() { - return collimark; - } - - /** - * Sets the collimating mark - * @param value The new colimating mark - */ - public void SetCollimatingMark(CollimatingMark value) { - this.collimark = value; - } - - -} diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/SignaturePosition.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/SignaturePosition.java deleted file mode 100644 index 48b320b3..00000000 --- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/SignaturePosition.java +++ /dev/null @@ -1,100 +0,0 @@ -package at.asit.pdfover.pdfsignator; - - -/** - * Represents the position of a visible signature block - * @author afitzek - */ -public class SignaturePosition { - /** - * The x value of the position - */ - protected int x = 0; - - /** - * The y value of the position - */ - protected int y = 0; - - /** - * The page value of the position - */ - protected int page = 1; - - /** - * Default constructor - */ - public SignaturePosition() { - } - - /** - * X - Y Constructor Page = 1 - * @param x The x value of the position - * @param y The y value of the position - */ - public SignaturePosition(int x, int y) { - this.x = x; - this.y = y; - } - - /** - * Constructor - * @param x The x value of the position - * @param y The y value of the position - * @param page The page value of the position - */ - public SignaturePosition(int x, int y, int page) { - this.x = x; - this.y = y; - this.page = page; - } - - /** - * Sets X value of position - * @param value the new x value - */ - public void SetX(int value) { - this.x = value; - } - - /** - * Gets the X value of the position - * @return int the x value of the position - */ - public int GetX() { - return this.x; - } - - /** - * Sets Y value of position - * @param value the new y value - */ - public void SetY(int value) { - this.y = value; - } - - /** - * Gets the Y value of the position - * @return int the y value of the position - */ - public int GetY() { - return this.y; - } - - /** - * Sets Page value of position - * @param value the new page value - */ - public void SetPage(int value) { - this.page = value; - } - - /** - * Gets the Page value of the position - * @return int the page value of the position - */ - public int GetPage() { - return this.page; - } - -} diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/SigningState.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/SigningState.java deleted file mode 100644 index 77479c12..00000000 --- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/SigningState.java +++ /dev/null @@ -1,26 +0,0 @@ -package at.asit.pdfover.pdfsignator; - -/** - * The state of the pdf signing library - * @author afitzek - */ -public interface SigningState { - - /** - * Gets the prepared Document - * @return - */ - public DocumentSource GetPreparedDocument(); - - /** - * Gets the Security Layer Request to create the signature - * @return The SL Signature Request - */ - public String GetSLSignatureRequest(); - - /** - * Sets the Security Layer Request to create the signature - * @param value The SL Signature Request - */ - public void SetSLSignatureResponse(String value); -} diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/CollimatingMark.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/CollimatingMark.java new file mode 100644 index 00000000..ad956fa7 --- /dev/null +++ b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/CollimatingMark.java @@ -0,0 +1,5 @@ +package at.asit.pdfover.pdfsigner; + +public class CollimatingMark { + +} diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/DocumentSource.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/DocumentSource.java new file mode 100644 index 00000000..af377c44 --- /dev/null +++ b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/DocumentSource.java @@ -0,0 +1,9 @@ +package at.asit.pdfover.pdfsigner; + +/** + * A Document Source + * @author afitzek + */ +public class DocumentSource { + +} diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/PDFSignatureException.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/PDFSignatureException.java new file mode 100644 index 00000000..19253af1 --- /dev/null +++ b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/PDFSignatureException.java @@ -0,0 +1,14 @@ +package at.asit.pdfover.pdfsigner; + +/** + * base class for signature exceptions + * @author afitzek + */ +public class PDFSignatureException extends Exception { + + /** + * + */ + private static final long serialVersionUID = 711578398780816710L; + +} diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/PDFSignerInterface.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/PDFSignerInterface.java new file mode 100644 index 00000000..6c8aa83b --- /dev/null +++ b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/PDFSignerInterface.java @@ -0,0 +1,38 @@ +package at.asit.pdfover.pdfsigner; + +import java.security.SignatureException; + +/** + * PDF Signator base Class + * This class should be extended to support PDF-AS and PADES. + * @author afitzek + */ +public interface PDFSignerInterface { + + /** + * Prepare a signature + * Defines signature parameters, the pdf library prepares the pdf document to sign and + * creates a Security Layer Request. + * @param parameter The signature parameters + * @return The siging state (contains the prepared document and the signature request + * @throws SignatureException + */ + public SigningState Prepare(SignatureParameter parameter) throws SignatureException; + + /** + * Adds the signature to the document. + * The SL Response has to be set in the state + * @param state The siging state + * @return The signature Result + * @throws SignatureException + */ + public SignResult Sign(SigningState state) throws SignatureException; + + /** + * Creates new signing profile + * @param base The profile id of the base profile + * @param profileID The id of the new profile + * @return The new Profile + */ + public SignatureParameter GetParameter(); +} diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SLRequest.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SLRequest.java new file mode 100644 index 00000000..74ad5862 --- /dev/null +++ b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SLRequest.java @@ -0,0 +1,13 @@ +package at.asit.pdfover.pdfsigner; + +/** + * Securtiy Layer Request + * @author afitzek + */ +public interface SLRequest { + /** + * Gets the signature data for this request + * @return The document source + */ + public DocumentSource GetSignatureData(); +} diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SLResponse.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SLResponse.java new file mode 100644 index 00000000..4d2e594a --- /dev/null +++ b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SLResponse.java @@ -0,0 +1,9 @@ +package at.asit.pdfover.pdfsigner; + +/** + * Securtiy Layer Response + * @author afitzek + */ +public class SLResponse { + +} diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignResult.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignResult.java new file mode 100644 index 00000000..6357fe11 --- /dev/null +++ b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignResult.java @@ -0,0 +1,28 @@ +package at.asit.pdfover.pdfsigner; + +import javax.security.cert.Certificate; + +/** + * Signature Result containing the signed document as document source + * @author afitzek + */ +public interface SignResult { + + /** + * Getter of the property signaturePosition + * @return Returns the signaturePosition. + */ + public SignaturePosition GetSignaturePosition(); + + /** + * Gets the signed Document + * @return Returns the documentSource. + */ + public DocumentSource GetSignedDocument(); + + /** + * Gets the signer certificate + * @return The signer x509 certificate + */ + public Certificate GetSignerCertificate(); +} diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignatureDimension.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignatureDimension.java new file mode 100644 index 00000000..57f628af --- /dev/null +++ b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignatureDimension.java @@ -0,0 +1,60 @@ +package at.asit.pdfover.pdfsigner; + +/** + * The Dimensions of the visible signature block + * @author afitzek + */ +public class SignatureDimension { + + /** + * The visible Signature block width + */ + protected int width; + + /** + * The visible Signature block height + */ + protected int height; + + /** + * Sets the width for the dimension + * @param value + */ + public void SetWidth(int value) { + this.width = value; + } + + /** + * Constructor + * @param width The width of the signature block + * @param height The height of the signature block + */ + public SignatureDimension(int width, int height) { + this.width = width; + this.height = height; + } + + /** + * Gets the width of the visible Signature block + * @return + */ + public int GetWidth() { + return this.width; + } + + /** + * Sets the height for the dimension + * @param value + */ + public void SetHeight(int value) { + this.height = value; + } + + /** + * Gets the height of the visible Signature block + * @return + */ + public int GetHeight() { + return this.height; + } +} diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignatureParameter.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignatureParameter.java new file mode 100644 index 00000000..422b2c75 --- /dev/null +++ b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignatureParameter.java @@ -0,0 +1,106 @@ +package at.asit.pdfover.pdfsigner; + +/** + * The Signature Parameter + * @author afitzek + */ +public abstract class SignatureParameter { + + /** + * The Signature Position + * @uml.property name="signaturePosition" + * @uml.associationEnd + */ + protected SignaturePosition signaturePosition = null; + + /** + * Getter of the property signaturePosition + * @return Returns the signaturePosition. + */ + public SignaturePosition GetSignaturePosition() { + return signaturePosition; + } + + /** + * Setter of the property signaturePosition + * @param signaturePosition The signaturePosition to set. + */ + public void SetSignaturePosition(SignaturePosition signaturePosition) { + this.signaturePosition = signaturePosition; + } + + /** + * The signature Device + */ + protected String KeyIdentifier = null; + + /** + * Getter of the property KeyIdentifier + * @return Returns the KeyIdentifier. + */ + public String GetKeyIdentifier() { + return KeyIdentifier; + } + + /** + * Setter of the property KeyIdentifier + * @param value The KeyIdentifier to set. + */ + public void SetKeyIdentifier(String value) { + this.KeyIdentifier = value; + } + + /** + * The signature Device + * @uml.property name="documentSource" + * @uml.associationEnd + */ + protected DocumentSource documentSource = null; + + /** + * Getter of the property documentSource + * @return Returns the documentSource. + */ + public DocumentSource GetInputDocument() { + return documentSource; + } + + /** + * Setter of the property documentSource + * @param value The documentSource to set. + */ + public void SetInputDocument(DocumentSource value) { + this.documentSource = value; + } + + /** + * Gets the Dimension to display the Placeholder + * @return the placeholder dimensions + */ + public abstract SignatureDimension GetPlaceholderDimension(); + + /** + * holds the collimating mark + * @uml.property name="collimark" + * @uml.associationEnd + */ + protected CollimatingMark collimark; + + /** + * Gets the collimating mark + * @return + */ + public CollimatingMark GetCollimatingMark() { + return collimark; + } + + /** + * Sets the collimating mark + * @param value The new colimating mark + */ + public void SetCollimatingMark(CollimatingMark value) { + this.collimark = value; + } + + +} diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignaturePosition.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignaturePosition.java new file mode 100644 index 00000000..f6d2aa81 --- /dev/null +++ b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignaturePosition.java @@ -0,0 +1,100 @@ +package at.asit.pdfover.pdfsigner; + + +/** + * Represents the position of a visible signature block + * @author afitzek + */ +public class SignaturePosition { + /** + * The x value of the position + */ + protected int x = 0; + + /** + * The y value of the position + */ + protected int y = 0; + + /** + * The page value of the position + */ + protected int page = 1; + + /** + * Default constructor + */ + public SignaturePosition() { + } + + /** + * X - Y Constructor Page = 1 + * @param x The x value of the position + * @param y The y value of the position + */ + public SignaturePosition(int x, int y) { + this.x = x; + this.y = y; + } + + /** + * Constructor + * @param x The x value of the position + * @param y The y value of the position + * @param page The page value of the position + */ + public SignaturePosition(int x, int y, int page) { + this.x = x; + this.y = y; + this.page = page; + } + + /** + * Sets X value of position + * @param value the new x value + */ + public void SetX(int value) { + this.x = value; + } + + /** + * Gets the X value of the position + * @return int the x value of the position + */ + public int GetX() { + return this.x; + } + + /** + * Sets Y value of position + * @param value the new y value + */ + public void SetY(int value) { + this.y = value; + } + + /** + * Gets the Y value of the position + * @return int the y value of the position + */ + public int GetY() { + return this.y; + } + + /** + * Sets Page value of position + * @param value the new page value + */ + public void SetPage(int value) { + this.page = value; + } + + /** + * Gets the Page value of the position + * @return int the page value of the position + */ + public int GetPage() { + return this.page; + } + +} diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SigningState.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SigningState.java new file mode 100644 index 00000000..ac0c736a --- /dev/null +++ b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SigningState.java @@ -0,0 +1,20 @@ +package at.asit.pdfover.pdfsigner; + +/** + * The state of the pdf signing library + * @author afitzek + */ +public interface SigningState { + + /** + * Gets the Security Layer Request to create the signature + * @return The SL Signature Request + */ + public SLRequest GetSLSignatureRequest(); + + /** + * Sets the Security Layer Request to create the signature + * @param value The SL Signature Request + */ + public void SetSLSignatureResponse(SLResponse value); +} diff --git a/pdf-over/pdf-signer-interface/src/model/PDFSignerInterface.ucd b/pdf-over/pdf-signer-interface/src/model/PDFSignerInterface.ucd index baf9fd52..cb7e79f8 100644 --- a/pdf-over/pdf-signer-interface/src/model/PDFSignerInterface.ucd +++ b/pdf-over/pdf-signer-interface/src/model/PDFSignerInterface.ucd @@ -1,169 +1,202 @@ - - - - - - - + + + + + + + - - + + + + + + + + + + + + - - + + - + - - - - - - - - - - - - + + + + + + + + + + + + - - + + - - - - + + + + + + - + - - + + - + - - + + - + - - + + - + - + - + - - - - - - - - - - - - + + + + + + + + + + + + - - + + - - - - - - + + + + + + - - + + - - + + - + - - + + - + - - + + - + - - - - - - - - + + + + + + + + - - + + - - - - - + + + + + - - - + + + - + - + - - - - - + + + + + - - - + + + + + + - - + - - - - - - + + + + + + - - + + - - + + - + - - + + - + + + + + + + + + + + + + + + + + + + + - + diff --git a/pdf-over/pdf-signer-interface/src/model/PDFSignerSequenz.usd b/pdf-over/pdf-signer-interface/src/model/PDFSignerSequenz.usd new file mode 100644 index 00000000..450d4fdf --- /dev/null +++ b/pdf-over/pdf-signer-interface/src/model/PDFSignerSequenz.usd @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pdf-over/pdf-signer-interface/src/model/images/PDFSignerInterface.svg b/pdf-over/pdf-signer-interface/src/model/images/PDFSignerInterface.svg new file mode 100644 index 00000000..37daf2cc --- /dev/null +++ b/pdf-over/pdf-signer-interface/src/model/images/PDFSignerInterface.svg @@ -0,0 +1,891 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GetPreparedDocument(): DocumentSource + + + GetSLSignatureRequest(): SLRequest + + + SetSLSignatureResponse(in value: SLResponse) + + + + SigningState + «interface» + + + + + + + + + + + + + + GetCollimatingMark(): CollimatingMark + + + GetInputDocument(): DocumentSource + + + GetKeyIdentifier(): String + + + GetPlaceholderDimension(): SignatureDimension + + + GetSignaturePosition(): SignaturePosition + + + SetCollimatingMark(in value: CollimatingMark) + + + SetInputDocument(in value: DocumentSource) + + + SetKeyIdentifier(in value: String) + + + SetSignaturePosition(in signaturePosition: SignaturePosition) + + + + SignatureParameter + + + + + + + + + + + + + + GetPage(): int + + + GetX(): int + + + GetY(): int + + + SetPage(in value: int) + + + SetX(in value: int) + + + SetY(in value: int) + + + SignaturePosition(in x: int, in y: int, in page: int) + + + SignaturePosition(in x: int, in y: int) + + + SignaturePosition() + + + + SignaturePosition + + + + + + + + + + + + + + GetParameter(): SignatureParameter + + + Prepare(in parameter: SignatureParameter): SigningState + + + Sign(in state: SigningState): SignResult + + + + PDFSignerInterface + «interface» + + + + + + + + + + + + + + GetHeight(): int + + + GetWidth(): int + + + SetHeight(in value: int) + + + SetWidth(in value: int) + + + SignatureDimension(in width: int, in height: int) + + + + SignatureDimension + + + + + + + + + DocumentSource + + + + + + + + + CollimatingMark + + + + + + + + + + + + + + GetSignaturePosition(): SignaturePosition + + + GetSignedDocument(): DocumentSource + + + GetSignerCertificate(): Certificate + + + + SignResult + «interface» + + + + + + + + + SLRequest + + + + + + + + + SLResponse + + + + «Import» + + + «Import» + + + «Import» + + + «Import» + + + + + # signaturePosition + 1 + + + + + + «Import» + + + «Import» + + + «Import» + + + «Import» + + + + + # collimark + 0..1 + + + + # documentSource + 1 + + + + + + «Import» + + + «Import» + + + «Import» + + + «Import» + + + + diff --git a/pdf-over/pom.xml b/pdf-over/pom.xml index c90f0877..13547627 100644 --- a/pdf-over/pom.xml +++ b/pdf-over/pom.xml @@ -68,5 +68,7 @@ pdf-signer-interface pdf-signer-pdf-as + pdf-signator-interface + pdf-signator -- cgit v1.2.3