时间戳服务

This commit is contained in:
zhangqinbin
2021-04-08 15:35:45 +08:00
parent cbe6c31c16
commit 969ebec653

View File

@ -1,5 +1,11 @@
package com.chinaunicom.mall.ebtp.extend.timeService.tsa; package com.chinaunicom.mall.ebtp.extend.timeService.tsa;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
/** /**
* CA 时间戳服务接口 * CA 时间戳服务接口
* *
@ -60,6 +66,10 @@ public interface TtsAgent {
public class TtsParseResult { public class TtsParseResult {
// 时间 // 时间
private String timestamp; private String timestamp;
// 时间
private Date datestamp;
// 时间
private LocalDateTime localDateTimestamp;
// hash 值 // hash 值
private String hash; private String hash;
@ -67,11 +77,19 @@ public interface TtsAgent {
// 签名证书 // 签名证书
private String cert; private String cert;
public TtsParseResult(String timestamp, String hash, String cert) { public TtsParseResult(String timestamp, String hash, String cert){
super(); super();
this.timestamp = timestamp; this.timestamp = timestamp;
this.hash = hash; this.hash = hash;
this.cert = cert; this.cert = cert;
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
this.localDateTimestamp =LocalDateTime.parse(timestamp,dtf);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
this.datestamp = sdf.parse(timestamp);
} catch (ParseException e) {
e.printStackTrace();
}
} }
public String getTimestamp() { public String getTimestamp() {