From d9809f2aebd1db461c2b7ebfcf580f0ab385376c Mon Sep 17 00:00:00 2001 From: ferbas Date: Fri, 13 Nov 2009 12:35:26 +0000 Subject: Timestamper support git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@388 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../egiz/pdfas/api/timestamp/DummyTimeStamper.java | 33 ++++++++++++++++++++++ .../gv/egiz/pdfas/api/timestamp/TimeStamper.java | 18 ++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 src/main/java/at/gv/egiz/pdfas/api/timestamp/DummyTimeStamper.java create mode 100644 src/main/java/at/gv/egiz/pdfas/api/timestamp/TimeStamper.java (limited to 'src/main/java/at/gv/egiz/pdfas/api') 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); + +} -- cgit v1.2.3