Record Class SignatureInfo

java.lang.Object
java.lang.Record
cloud.opencode.base.pdf.signature.SignatureInfo
Record Components:
name - signature name | 签名名称
reason - signing reason | 签名原因
location - signing location | 签名位置
contactInfo - contact information | 联系信息
signDate - signing date | 签名日期
certificates - certificate chain | 证书链
timestampInfo - timestamp info (if present) | 时间戳信息
isValid - whether signature is valid | 签名是否有效
coversWholeDoc - whether signature covers entire document | 签名是否覆盖整个文档
revisionNumber - revision number | 修订号

public record SignatureInfo(String name, String reason, String location, String contactInfo, Instant signDate, List<X509Certificate> certificates, TimestampInfo timestampInfo, boolean isValid, boolean coversWholeDoc, int revisionNumber) extends Record
Signature Information 签名信息

Contains details about a PDF digital signature.

包含 PDF 数字签名的详细信息。

Features | 主要功能:

  • Signature metadata (name, reason, location, contact) - 签名元数据(名称、原因、位置、联系方式)
  • Certificate chain access - 证书链访问
  • Timestamp information - 时间戳信息
  • Validity and coverage status - 有效性和覆盖状态

Usage Examples | 使用示例:

SignatureInfo info = SignatureInfo.builder()
    .name("Contract")
    .reason("Approval")
    .valid(true)
    .build();

String signer = info.getSignerName();
boolean hasTs = info.hasTimestamp();

Security | 安全性:

  • Thread-safe: Yes — immutable record - 线程安全: 是 — 不可变记录
  • Null-safe: Partial — fields may be null - 空值安全: 部分 — 字段可能为空
  • Defensive copies: Certificate list is copied on construction - 防御性拷贝: 证书列表在构造时进行拷贝
Since:
JDK 25, opencode-base-pdf V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Details

  • Method Details

    • getSignerCertificate

      public X509Certificate getSignerCertificate()
      Gets the signer certificate. 获取签名者证书。
      Returns:
      signer certificate, or null if none | 签名者证书,如果没有则返回 null
    • getSignerName

      public String getSignerName()
      Gets signer name from certificate. 从证书获取签名者名称。
      Returns:
      signer name | 签名者名称
    • hasTimestamp

      public boolean hasTimestamp()
      Checks if signature has timestamp. 检查签名是否有时间戳。
      Returns:
      true if has timestamp | 如果有时间戳返回 true
    • builder

      public static SignatureInfo.Builder builder()
      Creates a builder for signature info. 创建签名信息构建器。
      Returns:
      signature info builder | 签名信息构建器
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • reason

      public String reason()
      Returns the value of the reason record component.
      Returns:
      the value of the reason record component
    • location

      public String location()
      Returns the value of the location record component.
      Returns:
      the value of the location record component
    • contactInfo

      public String contactInfo()
      Returns the value of the contactInfo record component.
      Returns:
      the value of the contactInfo record component
    • signDate

      public Instant signDate()
      Returns the value of the signDate record component.
      Returns:
      the value of the signDate record component
    • certificates

      public List<X509Certificate> certificates()
      Returns the value of the certificates record component.
      Returns:
      the value of the certificates record component
    • timestampInfo

      public TimestampInfo timestampInfo()
      Returns the value of the timestampInfo record component.
      Returns:
      the value of the timestampInfo record component
    • isValid

      public boolean isValid()
      Returns the value of the isValid record component.
      Returns:
      the value of the isValid record component
    • coversWholeDoc

      public boolean coversWholeDoc()
      Returns the value of the coversWholeDoc record component.
      Returns:
      the value of the coversWholeDoc record component
    • revisionNumber

      public int revisionNumber()
      Returns the value of the revisionNumber record component.
      Returns:
      the value of the revisionNumber record component