Record Class TimestampInfo
java.lang.Object
java.lang.Record
cloud.opencode.base.pdf.signature.TimestampInfo
- Record Components:
time- timestamp time | 时间戳时间tsaCertificate- TSA certificate | TSA 证书hashAlgorithm- hash algorithm used | 使用的哈希算法serialNumber- timestamp serial number | 时间戳序列号isValid- whether timestamp is valid | 时间戳是否有效
public record TimestampInfo(Instant time, X509Certificate tsaCertificate, String hashAlgorithm, String serialNumber, boolean isValid)
extends Record
Timestamp Information
时间戳信息
Contains details about a timestamp in a PDF signature.
包含 PDF 签名中时间戳的详细信息。
Features | 主要功能:
- Timestamp time and validity status - 时间戳时间和有效性状态
- TSA certificate and name access - TSA 证书和名称访问
- Hash algorithm and serial number - 哈希算法和序列号
Usage Examples | 使用示例:
TimestampInfo ts = TimestampInfo.of(Instant.now());
Instant time = ts.time();
boolean valid = ts.isValid();
Security | 安全性:
- Thread-safe: Yes — immutable record - 线程安全: 是 — 不可变记录
- Null-safe: Partial — time is validated as non-null, other fields may be null - 空值安全: 部分 — 时间已验证非空,其他字段可能为空
- Since:
- JDK 25, opencode-base-pdf V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTimestampInfo(Instant time, X509Certificate tsaCertificate, String hashAlgorithm, String serialNumber, boolean isValid) Creates a new timestamp info. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.Gets TSA name from certificate.Returns the value of thehashAlgorithmrecord component.final inthashCode()Returns a hash code value for this object.booleanisValid()Returns the value of theisValidrecord component.static TimestampInfoCreates a timestamp info with only time.static TimestampInfoof(Instant time, X509Certificate tsaCertificate, String hashAlgorithm, String serialNumber) Creates a valid timestamp info.Returns the value of theserialNumberrecord component.time()Returns the value of thetimerecord component.final StringtoString()Returns a string representation of this record class.Returns the value of thetsaCertificaterecord component.
-
Constructor Details
-
TimestampInfo
public TimestampInfo(Instant time, X509Certificate tsaCertificate, String hashAlgorithm, String serialNumber, boolean isValid) Creates a new timestamp info. 创建新的时间戳信息。- Parameters:
time- timestamp time | 时间戳时间tsaCertificate- TSA certificate | TSA 证书hashAlgorithm- hash algorithm used | 使用的哈希算法serialNumber- timestamp serial number | 时间戳序列号isValid- whether timestamp is valid | 时间戳是否有效
-
-
Method Details
-
getTsaName
Gets TSA name from certificate. 从证书获取 TSA 名称。- Returns:
- TSA name, or null if no certificate | TSA 名称,如果没有证书则返回 null
-
of
public static TimestampInfo of(Instant time, X509Certificate tsaCertificate, String hashAlgorithm, String serialNumber) Creates a valid timestamp info. 创建有效的时间戳信息。- Parameters:
time- timestamp time | 时间戳时间tsaCertificate- TSA certificate | TSA 证书hashAlgorithm- hash algorithm | 哈希算法serialNumber- serial number | 序列号- Returns:
- timestamp info | 时间戳信息
-
of
Creates a timestamp info with only time. 创建仅包含时间的时间戳信息。- Parameters:
time- timestamp time | 时间戳时间- Returns:
- timestamp info | 时间戳信息
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
time
-
tsaCertificate
Returns the value of thetsaCertificaterecord component.- Returns:
- the value of the
tsaCertificaterecord component
-
hashAlgorithm
Returns the value of thehashAlgorithmrecord component.- Returns:
- the value of the
hashAlgorithmrecord component
-
serialNumber
Returns the value of theserialNumberrecord component.- Returns:
- the value of the
serialNumberrecord component
-
isValid
-