summaryrefslogtreecommitdiff
path: root/pdf-over-signer/src/main/java/at
diff options
context:
space:
mode:
authorJakob Heher <jakob.heher@iaik.tugraz.at>2022-09-30 14:24:16 +0200
committerJakob Heher <jakob.heher@iaik.tugraz.at>2022-09-30 14:24:16 +0200
commit9a513d43b310f2e6283fa195a8aa11493a7dcb2c (patch)
tree2038e303e454004ed719cfebe2dfb554571b86b5 /pdf-over-signer/src/main/java/at
parent96ba5fe6185cfdeb326ae3148ce88f299e41ef25 (diff)
downloadpdf-over-9a513d43b310f2e6283fa195a8aa11493a7dcb2c.tar.gz
pdf-over-9a513d43b310f2e6283fa195a8aa11493a7dcb2c.tar.bz2
pdf-over-9a513d43b310f2e6283fa195a8aa11493a7dcb2c.zip
kill off pdfover-signator
Diffstat (limited to 'pdf-over-signer/src/main/java/at')
-rw-r--r--pdf-over-signer/src/main/java/at/asit/pdfover/signer/BkuSlConnector.java32
-rw-r--r--pdf-over-signer/src/main/java/at/asit/pdfover/signer/ByteArrayDocumentSource.java55
-rw-r--r--pdf-over-signer/src/main/java/at/asit/pdfover/signer/DocumentSource.java44
-rw-r--r--pdf-over-signer/src/main/java/at/asit/pdfover/signer/Emblem.java200
-rw-r--r--pdf-over-signer/src/main/java/at/asit/pdfover/signer/PDFFileDocumentSource.java88
-rw-r--r--pdf-over-signer/src/main/java/at/asit/pdfover/signer/SignResult.java65
-rw-r--r--pdf-over-signer/src/main/java/at/asit/pdfover/signer/SignatureException.java62
-rw-r--r--pdf-over-signer/src/main/java/at/asit/pdfover/signer/SignaturePosition.java124
-rw-r--r--pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4BKUSLConnector.java4
-rw-r--r--pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Helper.java2
-rw-r--r--pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SLRequest.java3
-rw-r--r--pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java8
-rw-r--r--pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java8
-rw-r--r--pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SigningState.java4
14 files changed, 684 insertions, 15 deletions
diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/BkuSlConnector.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/BkuSlConnector.java
new file mode 100644
index 00000000..d91e8466
--- /dev/null
+++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/BkuSlConnector.java
@@ -0,0 +1,32 @@
+/*
+ * 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.signer;
+
+import at.asit.pdfover.signer.pdfas.PdfAs4SLRequest;
+
+// Imports
+
+/**
+ *
+ */
+public interface BkuSlConnector {
+ /**
+ * @param request
+ * @return SL Response
+ * @throws SignatureException
+ */
+ public String handleSLRequest(PdfAs4SLRequest request) throws SignatureException;
+}
diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/ByteArrayDocumentSource.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/ByteArrayDocumentSource.java
new file mode 100644
index 00000000..024722cc
--- /dev/null
+++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/ByteArrayDocumentSource.java
@@ -0,0 +1,55 @@
+/*
+ * 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.signer;
+
+//Imports
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+/**
+ * A DocumentSource using a byte[] to store the document content
+ */
+public class ByteArrayDocumentSource implements DocumentSource {
+
+ /**
+ * Document content
+ */
+ protected byte[] data;
+
+ /**
+ * Constructor with byte[] content
+ * @param data the document content
+ */
+ public ByteArrayDocumentSource(byte[] data) {
+ this.data = data;
+ }
+
+ @Override
+ public InputStream getInputStream() {
+ return new ByteArrayInputStream(this.data);
+ }
+
+ @Override
+ public int getLength() {
+ return this.data.length;
+ }
+
+ @Override
+ public byte[] getByteArray() {
+ return this.data;
+ }
+
+}
diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/DocumentSource.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/DocumentSource.java
new file mode 100644
index 00000000..2276c257
--- /dev/null
+++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/DocumentSource.java
@@ -0,0 +1,44 @@
+/*
+ * 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.signer;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * A Document Source
+ */
+public interface DocumentSource {
+
+ /**
+ * Gets the InputStream for this Document
+ * @return InputStream for the document
+ * @throws IOException
+ */
+ public InputStream getInputStream() throws IOException;
+
+ /**
+ * Get Length of document
+ * @return length of the document
+ */
+ public int getLength();
+
+ /**
+ * Get Document as byte[]
+ * @return byte[] of the Document
+ */
+ public byte[] getByteArray();
+}
diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/Emblem.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/Emblem.java
new file mode 100644
index 00000000..c045169a
--- /dev/null
+++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/Emblem.java
@@ -0,0 +1,200 @@
+/*
+ * 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.signer;
+
+// Imports
+import at.asit.pdfover.commons.Constants;
+import at.asit.pdfover.commons.utils.ImageUtil;
+
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Properties;
+
+import javax.imageio.ImageIO;
+
+import org.apache.commons.codec.digest.DigestUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * TODO all of this caching business is a bit of a mess
+ */
+public class Emblem {
+ /**
+ * SLF4J Logger instance
+ **/
+ private static final Logger log = LoggerFactory.getLogger(Emblem.class);
+
+ private static final String CACHE_DIR = Constants.CONFIG_DIRECTORY;
+ private static final String CACHE_IMG_FILENAME = ".emblem.png";
+ private static final String CACHE_IMG_FORMAT = "png";
+ private static final String CACHE_PROPS_FILENAME = ".emblem.properties";
+
+ private static final String PROPKEY_ORIG_PATH = "IMG";
+ private static final String PROPKEY_ORIG_DIGEST = "HSH";
+ private static final int MAX_EMBLEM_WIDTH = 480;
+ private static final int MAX_EMBLEM_HEIGHT = 600;
+
+ private String originalFileName = null;
+ private String originalFileHash = null;
+ private Image image = null; /* image data, if we have it */
+
+ private void lazyLoadImage() {
+ if (this.image != null) return;
+
+ String filename = getCachedFileName();
+ if (this.image != null) return; /* getCachedFileName may have re-generated the cache and populated this.image */
+
+ try {
+ this.image = ImageUtil.readImageWithEXIFRotation(new File(filename));
+ } catch (IOException e) {
+ log.warn("Failed to load Emblem image");
+ }
+ }
+
+ public int getWidth() { if (image == null) lazyLoadImage(); return (image != null) ? image.getWidth(null) : 0; }
+ public int getHeight() { if (image == null) lazyLoadImage(); return (image != null) ? image.getHeight(null) : 0; }
+
+ /**
+ * Constructor
+ * @param filename
+ */
+ public Emblem(String filename) {
+ this.originalFileName = filename;
+ }
+
+ private String getFileHash(String filename) throws IOException {
+ InputStream is = Files.newInputStream(Path.of(filename));
+ return DigestUtils.md5Hex(is);
+ }
+
+ private static BufferedImage reduceImageSizeIfNecessary(BufferedImage img, int maxWidth, int maxHeight) {
+ int oheight = img.getHeight();
+ int owidth = img.getWidth();
+
+ double ratio = (double)owidth/(double)oheight;
+
+ int height = oheight;
+ int width = owidth;
+ if (height > maxHeight) {
+ height = maxHeight;
+ width = (int) (maxHeight * ratio);
+ }
+ if (width > maxWidth) {
+ width = maxWidth;
+ height = (int) (maxWidth / ratio);
+ }
+ BufferedImage result = img;
+ if (width != owidth || height != oheight) {
+ //scale image
+ log.debug("Scaling emblem: " + owidth + "x" + oheight + " to " + width + "x" + height);
+ result = new BufferedImage(width, height, img.getType() == 0 ? BufferedImage.TYPE_INT_ARGB : img.getType());
+ Graphics2D g = result.createGraphics();
+ g.drawImage(img, 0, 0, width, height, null);
+ g.dispose();
+ }
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.signator.Emblem#getFileName()
+ */
+ public String getCachedFileName() {
+ String emblemImg = this.originalFileName;
+ String emblemHsh = null;
+ String cachedEmblemFileName = CACHE_DIR + File.separator + CACHE_IMG_FILENAME;
+
+ if (emblemImg == null || !(new File(emblemImg).exists()))
+ return null;
+
+ Properties emblemProps = new Properties();
+ // compare cache, try to load if match
+ try {
+ File cacheProps = new File(CACHE_DIR, CACHE_PROPS_FILENAME);
+ if (cacheProps.exists()) {
+ InputStream in = new FileInputStream(cacheProps);
+ emblemProps.load(in);
+ if (emblemImg.equals(emblemProps.getProperty(PROPKEY_ORIG_PATH))) {
+ emblemHsh = getFileHash(emblemImg);
+ if (emblemHsh.equals(emblemProps.getProperty(PROPKEY_ORIG_DIGEST))) {
+ log.debug("Emblem cache hit: " + cachedEmblemFileName);
+ return cachedEmblemFileName;
+ }
+ }
+ }
+ log.debug("Emblem cache miss");
+ } catch (Exception e) {
+ log.warn("Can't load emblem cache", e);
+ }
+
+ try {
+ // create new cache
+ if (emblemHsh == null)
+ emblemHsh = getFileHash(emblemImg);
+ emblemProps.setProperty(PROPKEY_ORIG_PATH, emblemImg);
+ emblemProps.setProperty(PROPKEY_ORIG_DIGEST, emblemHsh);
+ File imgFile = new File(emblemImg);
+
+ BufferedImage img = ImageUtil.readImageWithEXIFRotation(imgFile);
+ img = reduceImageSizeIfNecessary(img, MAX_EMBLEM_WIDTH, MAX_EMBLEM_HEIGHT);
+
+ File file = new File(CACHE_DIR, CACHE_IMG_FILENAME);
+ ImageIO.write(img, CACHE_IMG_FORMAT, file); // ignore returned boolean
+ this.image = img;
+ OutputStream out = new FileOutputStream(new File(CACHE_DIR, CACHE_PROPS_FILENAME));
+ emblemProps.store(out, null);
+ } catch (IOException e) {
+ log.error("Can't save emblem cache", e);
+ return this.originalFileName;
+ }
+ return cachedEmblemFileName;
+ }
+
+ /**
+ * Return the original filename
+ * @return the original filename
+ */
+ public String getOriginalFileName() {
+ return this.originalFileName;
+ }
+
+ /**
+ * Return the original filename
+ * @return the original filename
+ */
+ public String getOriginalFileHash() {
+ if (this.originalFileHash == null) {
+ if (this.originalFileName == null || !(new File(this.originalFileName).exists())) {
+ this.originalFileHash = "";
+ } else try {
+ this.originalFileHash = getFileHash(this.originalFileName);
+ } catch (IOException e) {
+ log.debug("Error getting file hash", e);
+ this.originalFileHash = "";
+ }
+ }
+ return this.originalFileHash;
+ }
+}
diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/PDFFileDocumentSource.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/PDFFileDocumentSource.java
new file mode 100644
index 00000000..7dc5ef6a
--- /dev/null
+++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/PDFFileDocumentSource.java
@@ -0,0 +1,88 @@
+/*
+ * 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.signer;
+
+// Imports
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ */
+public class PDFFileDocumentSource implements DocumentSource {
+ /**
+ * SLF4J Logger instance
+ **/
+ private static final Logger log = LoggerFactory.getLogger(PDFFileDocumentSource.class);
+
+ private File file;
+
+ private byte[] data = null;
+
+ private int len = 0;
+
+ /**
+ * Default constructor
+ * @param file
+ */
+ public PDFFileDocumentSource(File file) {
+ this.file = file;
+ }
+
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.signator.DocumentSource#getInputStream()
+ */
+ @Override
+ public InputStream getInputStream() throws IOException {
+ return new FileInputStream(this.file);
+ }
+
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.signator.DocumentSource#getLength()
+ */
+ @Override
+ public int getLength() {
+ if(this.file.length() > Integer.MAX_VALUE) {
+ log.error("File size to big!" + this.file.length());
+ }
+ this.len = (int) this.file.length();
+ return this.len;
+ }
+
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.signator.DocumentSource#getByteArray()
+ */
+ @Override
+ public byte[] getByteArray() {
+ if(this.data == null) {
+ try {
+ InputStream stream = this.getInputStream();
+ this.data = new byte[this.getLength()];
+ stream.read(this.data);
+ stream.close();
+ } catch(IOException ex) {
+ log.error("Failed to read file!", ex);
+ }
+ }
+ return this.data;
+ }
+
+}
diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/SignResult.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/SignResult.java
new file mode 100644
index 00000000..d9aa5075
--- /dev/null
+++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/SignResult.java
@@ -0,0 +1,65 @@
+/*
+ * 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.signer;
+
+//Imports
+import java.security.cert.X509Certificate;
+
+/**
+ * The result of a signature operation
+ */
+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;
+ }
+
+ /**
+ * 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/SignatureException.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/SignatureException.java
new file mode 100644
index 00000000..87b37dfe
--- /dev/null
+++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/SignatureException.java
@@ -0,0 +1,62 @@
+/*
+ * 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.signer;
+
+//Imports
+
+/**
+ * Base class for signature exceptions
+ */
+public class SignatureException extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 711578398780816710L;
+
+
+ /**
+ * Empty constructor
+ */
+ public SignatureException() {
+ super();
+ }
+
+ /**
+ * Constructor with causing exception
+ * @param cause the cause
+ */
+ public SignatureException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Constructor with message
+ * @param msg the message
+ */
+ public SignatureException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Constructor with message and causing exception
+ * @param message the message
+ * @param cause the cause
+ */
+ public SignatureException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/SignaturePosition.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/SignaturePosition.java
new file mode 100644
index 00000000..81871506
--- /dev/null
+++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/SignaturePosition.java
@@ -0,0 +1,124 @@
+/*
+ * 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.signer;
+
+//Imports
+
+/**
+ * Represents the position of a visible signature block
+ */
+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 = 0;
+
+ /**
+ * Whether automatic positioning is used
+ */
+ protected boolean autoPositioning;
+
+ /**
+ * Default constructor
+ * No position given, hence automatic positioning will be used
+ */
+ public SignaturePosition() {
+ this.autoPositioning = true;
+ }
+
+ /**
+ * X - Y Constructor (Page = 0)
+ * @param x The x value of the position
+ * @param y The y value of the position
+ */
+ public SignaturePosition(float x, float y) {
+ this.autoPositioning = false;
+ setPosition(x, y);
+ }
+
+ /**
+ * Constructor
+ * @param x The x value of the signature position
+ * @param y The y value of the signature position
+ * @param page The page value of the signature position
+ */
+ public SignaturePosition(float x, float y, int page) {
+ this.autoPositioning = false;
+ setPosition(x, y);
+ setPage(page);
+ }
+
+ /**
+ * Sets new position
+ * @param x the new x value
+ * @param y the new y value
+ */
+ public void setPosition(float x, float y) {
+ this.x = x;
+ this.y = y;
+ }
+
+ /**
+ * Gets the X value of the position
+ * @return float the x value of the position
+ */
+ public float getX() {
+ return this.x;
+ }
+
+ /**
+ * 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 page the new page value
+ */
+ public void setPage(int page) {
+ this.page = page;
+ }
+
+ /**
+ * Gets the Page value of the position
+ * @return int the page value of the position
+ */
+ public int getPage() {
+ return this.page;
+ }
+
+ /**
+ * Gets whether automatic positioning is used
+ * @return true if the signature position is determined automatically
+ */
+ public boolean useAutoPositioning() {
+ return this.autoPositioning;
+ }
+}
diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4BKUSLConnector.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4BKUSLConnector.java
index 4c87542d..533a0487 100644
--- a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4BKUSLConnector.java
+++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4BKUSLConnector.java
@@ -22,8 +22,8 @@ import javax.xml.bind.JAXBException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import at.asit.pdfover.signator.BkuSlConnector;
-import at.asit.pdfover.signator.SignatureException;
+import at.asit.pdfover.signer.BkuSlConnector;
+import at.asit.pdfover.signer.SignatureException;
import at.asit.pdfover.signer.pdfas.exceptions.PdfAs4SLRequestException;
import at.gv.egiz.pdfas.common.exceptions.PDFIOException;
import at.gv.egiz.pdfas.common.exceptions.PdfAsException;
diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Helper.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Helper.java
index a41f2378..45dc2724 100644
--- a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Helper.java
+++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Helper.java
@@ -21,7 +21,7 @@ import java.io.File;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import at.asit.pdfover.signator.SignatureException;
+import at.asit.pdfover.signer.SignatureException;
import at.gv.egiz.pdfas.lib.api.PdfAs;
import at.gv.egiz.pdfas.lib.api.PdfAsFactory;
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 20c919f2..785d6089 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
@@ -15,8 +15,7 @@
*/
package at.asit.pdfover.signer.pdfas;
-// Imports
-import at.asit.pdfover.signator.ByteArrayDocumentSource;
+import at.asit.pdfover.signer.ByteArrayDocumentSource;
import at.asit.pdfover.signer.pdfas.exceptions.PdfAs4SLRequestException;
/**
diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java
index 745f10ea..e45de3fa 100644
--- a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java
+++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java
@@ -28,14 +28,14 @@ import java.util.Locale;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import at.asit.pdfover.signator.BKUs;
-import at.asit.pdfover.signator.DocumentSource;
-import at.asit.pdfover.signator.Emblem;
-import at.asit.pdfover.signator.SignaturePosition;
+import at.asit.pdfover.signer.DocumentSource;
+import at.asit.pdfover.signer.Emblem;
+import at.asit.pdfover.signer.SignaturePosition;
import at.gv.egiz.pdfas.lib.api.Configuration;
import at.gv.egiz.pdfas.lib.api.PdfAs;
import at.gv.egiz.pdfas.lib.api.PdfAsFactory;
import at.gv.egiz.pdfas.lib.api.sign.SignParameter;
+import at.asit.pdfover.commons.BKUs;
import at.asit.pdfover.commons.Constants;
import at.asit.pdfover.commons.Profile;
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 e0790dfc..80a7e14d 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
@@ -7,10 +7,10 @@ import javax.activation.DataSource;
import at.asit.pdfover.commons.Constants;
import at.asit.pdfover.commons.Profile;
-import at.asit.pdfover.signator.ByteArrayDocumentSource;
-import at.asit.pdfover.signator.SignResult;
-import at.asit.pdfover.signator.SignatureException;
-import at.asit.pdfover.signator.SignaturePosition;
+import at.asit.pdfover.signer.ByteArrayDocumentSource;
+import at.asit.pdfover.signer.SignResult;
+import at.asit.pdfover.signer.SignatureException;
+import at.asit.pdfover.signer.SignaturePosition;
import at.gv.egiz.pdfas.common.exceptions.PDFASError;
import at.gv.egiz.pdfas.common.exceptions.PdfAsException;
import at.gv.egiz.pdfas.lib.api.ByteArrayDataSource;
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 2192f380..3ff0f75a 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
@@ -18,8 +18,8 @@ package at.asit.pdfover.signer.pdfas;
//Imports
import java.io.ByteArrayOutputStream;
-import at.asit.pdfover.signator.BkuSlConnector;
-import at.asit.pdfover.signator.SignatureException;
+import at.asit.pdfover.signer.BkuSlConnector;
+import at.asit.pdfover.signer.SignatureException;
import at.gv.egiz.pdfas.common.exceptions.PDFASError;
import at.gv.egiz.pdfas.lib.api.sign.IPlainSigner;
import at.gv.egiz.pdfas.lib.api.sign.SignParameter;