aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorferbas <ferbas@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2009-11-13 12:35:26 +0000
committerferbas <ferbas@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2009-11-13 12:35:26 +0000
commitd9809f2aebd1db461c2b7ebfcf580f0ab385376c (patch)
tree7ece890f7a7e876c9c92ac17b40b3a03dbc84fbc /src/main
parent769ca1275167b1469dfa894283b8a1d86b189e91 (diff)
downloadpdf-as-3-d9809f2aebd1db461c2b7ebfcf580f0ab385376c.tar.gz
pdf-as-3-d9809f2aebd1db461c2b7ebfcf580f0ab385376c.tar.bz2
pdf-as-3-d9809f2aebd1db461c2b7ebfcf580f0ab385376c.zip
Timestamper support
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@388 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/gv/egiz/pdfas/api/timestamp/DummyTimeStamper.java33
-rw-r--r--src/main/java/at/gv/egiz/pdfas/api/timestamp/TimeStamper.java18
2 files changed, 51 insertions, 0 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/api/timestamp/DummyTimeStamper.java b/src/main/java/at/gv/egiz/pdfas/api/timestamp/DummyTimeStamper.java
new file mode 100644
index 0000000..cbd7bdb
--- /dev/null
+++ b/src/main/java/at/gv/egiz/pdfas/api/timestamp/DummyTimeStamper.java
@@ -0,0 +1,33 @@
+package at.gv.egiz.pdfas.api.timestamp;
+
+import java.util.Date;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class DummyTimeStamper implements TimeStamper {
+ private static Log log = LogFactory.getLog(DummyTimeStamper.class);
+
+ private String lastTimeStamp;
+
+ public String applyTimeStamp(String b64SignatureValue) {
+ log.debug("execute dummy timestamp on value: " + b64SignatureValue);
+ String ts = ("my dummy timestamp " + new Date());
+ log.debug("timestamp: " + ts);
+
+ ts = new String(Base64.encodeBase64(ts.getBytes()));
+ log.debug("timestamp b64: " + ts);
+ this.lastTimeStamp = ts;
+ return ts;
+ }
+
+ public String getLastTimeStamp() {
+ return this.lastTimeStamp;
+ }
+
+ public void setLastTimeStamp(String lastTimeStamp) {
+ this.lastTimeStamp = lastTimeStamp;
+ }
+
+}
diff --git a/src/main/java/at/gv/egiz/pdfas/api/timestamp/TimeStamper.java b/src/main/java/at/gv/egiz/pdfas/api/timestamp/TimeStamper.java
new file mode 100644
index 0000000..7100310
--- /dev/null
+++ b/src/main/java/at/gv/egiz/pdfas/api/timestamp/TimeStamper.java
@@ -0,0 +1,18 @@
+package at.gv.egiz.pdfas.api.timestamp;
+
+/**
+ * Interface for timestamper implementations/handlers
+ *
+ * @author dferbas
+ *
+ */
+public interface TimeStamper {
+
+ /**
+ * Implement timestamp in this method.
+ * @param b64SignatureValue signature value, base64 encoded
+ * @return timestamp to be embedded in egiz dict. base64 encoded
+ */
+ public String applyTimeStamp(String b64SignatureValue);
+
+}