aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);
+
+}