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; /** * Dummy/test implementation of the timestamper. Logs and stores test-timestamp for assertion {@link #getLastTimeStamp()} * * @author dferbas * */ 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; } }