diff options
Diffstat (limited to 'pdf-over/pdf-signer-interface/src/main/java')
16 files changed, 0 insertions, 634 deletions
diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/ByteArrayDocumentSource.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/ByteArrayDocumentSource.java deleted file mode 100644 index 27e0c537..00000000 --- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/ByteArrayDocumentSource.java +++ /dev/null @@ -1,29 +0,0 @@ -package at.asit.pdfover.pdfsigner; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; - -public class ByteArrayDocumentSource implements DocumentSource { - - protected byte[] data; - - public ByteArrayDocumentSource(byte[] data) { - this.data = data; - } - - @Override - public InputStream GetInputStream() { - return new ByteArrayInputStream(this.data); - } - - @Override - public int GetLength() { - return data.length; - } - - @Override - public byte[] GetByteArray() { - return data; - } - -} 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 deleted file mode 100644 index cfca74fa..00000000 --- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/CollimatingMark.java +++ /dev/null @@ -1,6 +0,0 @@ -package at.asit.pdfover.pdfsigner; - -public interface CollimatingMark { - - public String GetFileName(); -} 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 deleted file mode 100644 index dafe9797..00000000 --- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/DocumentSource.java +++ /dev/null @@ -1,29 +0,0 @@ -package at.asit.pdfover.pdfsigner; - -import java.io.InputStream; - -/** - * A Document Source - * - * @author afitzek - */ -public interface DocumentSource { - - /** - * Gets Document as INput Stream - * @return - */ - public InputStream GetInputStream(); - - /** - * Get Length of document - * @return - */ - public int GetLength(); - - /** - * Get byte[] - * @return - */ - public byte[] GetByteArray(); -} diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/PDFSignator.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/PDFSignator.java deleted file mode 100644 index 9fb14b4a..00000000 --- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/PDFSignator.java +++ /dev/null @@ -1,68 +0,0 @@ -package at.asit.pdfover.pdfsigner; - -import java.util.HashMap; -import java.util.Map; - -/** - * PDF Signator Interface - * @author afitzek - */ -public class PDFSignator { - - protected static Map<PDFSigner, PDFSignerFactory> _factory; - - // Let Factory choose if instance can be cached or not - //protected static Map<PDFSigner, PDFSignerInterface> _signer; - - static { - //_signer = new HashMap<PDFSigner, PDFSignerInterface>(); - _factory = new HashMap<PDFSigner, PDFSignerFactory>(); - - - try { - @SuppressWarnings("rawtypes") - Class pdfAsClass = Class.forName("at.asit.pdfover.pdfsigner.pdfas.PDFASSignerFactory"); - PDFSignerFactory factory = (PDFSignerFactory)pdfAsClass.newInstance(); - RegisterPDFSigner(factory.GetPDFSignerType(), factory); - } catch (ClassNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (InstantiationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalAccessException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - - public static void RegisterPDFSigner(PDFSigner signer, PDFSignerFactory factory) { - _factory.put(signer, factory); - } - - protected static PDFSignerInterface GetSigner(PDFSigner signer) throws PDFSignatureException { - /*if (_signer.containsKey(signer)) { - return _signer.get(signer); - }*/ - - if(_factory.containsKey(signer)) { - //_signer.put(signer, _factory.get(signer).CreatePDFSigner()); - return _factory.get(signer).CreatePDFSigner(); - } else { - throw new PDFSignatureException("Unknown PDF Library: " + signer.toString()); - } - - //return _signer.get(signer); - } - - /** - * Gets a PDF Signer according to the chosen pdf signer library - * @param signer - * @return - * @throws PDFSignatureException - */ - public static PDFSignerInterface GetPDFSigner(PDFSigner signer) throws PDFSignatureException { - return GetSigner(signer); - } -} 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 deleted file mode 100644 index 5a9a0073..00000000 --- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/PDFSignatureException.java +++ /dev/null @@ -1,21 +0,0 @@ -package at.asit.pdfover.pdfsigner; - -/** - * base class for signature exceptions - * @author afitzek - */ -public class PDFSignatureException extends Exception { - - /** - * - */ - private static final long serialVersionUID = 711578398780816710L; - - public PDFSignatureException(Throwable e) { - super(e); - } - - public PDFSignatureException(String msg) { - super(msg); - } -} diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/PDFSigner.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/PDFSigner.java deleted file mode 100644 index 332c111b..00000000 --- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/PDFSigner.java +++ /dev/null @@ -1,20 +0,0 @@ -/** - * - */ -package at.asit.pdfover.pdfsigner; - -/** - * Available PDF Signer libraries - * @author afitzek - */ -public enum PDFSigner { - /** - * @uml.property name="pDFAS" - * @uml.associationEnd - */ - PDFAS { - public String toString() { - return "PDFAS"; - } - } -} diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/PDFSignerFactory.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/PDFSignerFactory.java deleted file mode 100644 index 348c649a..00000000 --- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/PDFSignerFactory.java +++ /dev/null @@ -1,6 +0,0 @@ -package at.asit.pdfover.pdfsigner; - -public abstract class PDFSignerFactory { - public abstract PDFSignerInterface CreatePDFSigner(); - public abstract PDFSigner GetPDFSignerType(); -} 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 deleted file mode 100644 index 0d9592dc..00000000 --- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/PDFSignerInterface.java +++ /dev/null @@ -1,36 +0,0 @@ -package at.asit.pdfover.pdfsigner; - -/** - * 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 PDFSignatureException; - - /** - * 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 PDFSignatureException; - - /** - * 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 deleted file mode 100644 index 74ad5862..00000000 --- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SLRequest.java +++ /dev/null @@ -1,13 +0,0 @@ -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 deleted file mode 100644 index de98aa1a..00000000 --- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SLResponse.java +++ /dev/null @@ -1,18 +0,0 @@ -package at.asit.pdfover.pdfsigner; - -/** - * Securtiy Layer Response - * @author afitzek - */ -public class SLResponse { - - private String response; - - public SLResponse(String value) { - response = value; - } - - public String GetSLRespone() { - return this.response; - } -} 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 deleted file mode 100644 index 8069da4e..00000000 --- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignResult.java +++ /dev/null @@ -1,28 +0,0 @@ -package at.asit.pdfover.pdfsigner; - -import java.security.cert.X509Certificate; - -/** - * Signature Result containing the signed document as document source - * @author afitzek - */ -public interface SignResult { - - /** - * Getter of the property <tt>signaturePosition</tt> - * @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 X509Certificate GetSignerCertificate(); -} diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignResultImpl.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignResultImpl.java deleted file mode 100644 index 72a08d1f..00000000 --- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignResultImpl.java +++ /dev/null @@ -1,37 +0,0 @@ -package at.asit.pdfover.pdfsigner; - -import java.security.cert.X509Certificate; - -public class SignResultImpl implements SignResult { - - private SignaturePosition position; - private DocumentSource source; - private X509Certificate certificate; - - @Override - public SignaturePosition GetSignaturePosition() { - return position; - } - - @Override - public DocumentSource GetSignedDocument() { - return source; - } - - @Override - public X509Certificate GetSignerCertificate() { - return certificate; - } - - public void SetSignerCertificate(X509Certificate x509Certificate) { - this.certificate = x509Certificate; - } - - public void SetSignaturePosition(SignaturePosition postion) { - this.position = postion; - } - - public void SetSignedDocument(DocumentSource source) { - this.source = source; - } -} 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 deleted file mode 100644 index 57f628af..00000000 --- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignatureDimension.java +++ /dev/null @@ -1,60 +0,0 @@ -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 deleted file mode 100644 index 5876f1ef..00000000 --- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignatureParameter.java +++ /dev/null @@ -1,126 +0,0 @@ -package at.asit.pdfover.pdfsigner; - -import java.util.HashMap; - -/** - * 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 <tt>signaturePosition</tt> - * @return Returns the signaturePosition. - */ - public SignaturePosition GetSignaturePosition() { - return signaturePosition; - } - - /** - * Setter of the property <tt>signaturePosition</tt> - * @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 <tt>KeyIdentifier</tt> - * @return Returns the KeyIdentifier. - */ - public String GetKeyIdentifier() { - return KeyIdentifier; - } - - /** - * Setter of the property <tt>KeyIdentifier</tt> - * @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 <tt>documentSource</tt> - * @return Returns the documentSource. - */ - public DocumentSource GetInputDocument() { - return documentSource; - } - - /** - * Setter of the property <tt>documentSource</tt> - * @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; - } - - protected HashMap<String, String> _properties = new HashMap<String, String>(); - - /** - * Sets generic properties - * @param key - * @param value - */ - public void SetProperty(String key, String value) { - this._properties.put(key, value); - } - - /** - * Gets generic properties - * @param key - * @return - */ - public String GetProperty(String key) { - return this._properties.get(key); - } -} 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 deleted file mode 100644 index 82f37deb..00000000 --- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignaturePosition.java +++ /dev/null @@ -1,117 +0,0 @@ -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 float x = 0; - - /** - * The y value of the position - */ - protected float y = 0; - - /** - * The page value of the position - */ - protected int page = 1; - - protected boolean auto = true; - - /** - * 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(float x, float 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(float x, float 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(float value) { - this.x = value; - } - - /** - * Gets the X value of the position - * @return float the x value of the position - */ - public float GetX() { - return this.x; - } - - /** - * Sets Y value of position - * @param value the new y value - */ - public void SetY(float value) { - this.y = value; - } - - /** - * Gets the Y value of the position - * @return float the y value of the position - */ - public float 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; - } - - /** - * Sets Page value of position - * @param value the new page value - */ - public void SetAuto(boolean value) { - this.auto = value; - } - - /** - * Gets the Page value of the position - * @return int the page value of the position - */ - public boolean GetAuto() { - return this.auto; - } -} 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 deleted file mode 100644 index d1920135..00000000 --- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SigningState.java +++ /dev/null @@ -1,20 +0,0 @@ -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 abstract SLRequest GetSLSignatureRequest(); - - /** - * Sets the Security Layer Request to create the signature - * @param value The SL Signature Request - */ - public abstract void SetSLSignatureResponse(SLResponse value); -} |