Class SignedCertificateTimestamp


  • public class SignedCertificateTimestamp
    extends java.lang.Object
    A single Signed Certificate Timestamp (SCT) in the RFC 6962 (CT v1) wire format. Decoded from the TLS-encoded payload of a SignedCertificateTimestampList.
         enum { v1(0), (255) } Version;
    
         struct {
             opaque key_id[32];
         } LogID;
    
         opaque CtExtensions<0..2^16-1>;
    
         struct {
             Version          sct_version;
             LogID            id;
             uint64           timestamp;
             CtExtensions     extensions;
             digitally-signed struct {
                 Version       sct_version;
                 SignatureType signature_type = certificate_timestamp;
                 uint64        timestamp;
                 LogEntryType  entry_type;
                 select(entry_type) {
                     case x509_entry:    ASN.1Cert;
                     case precert_entry: PreCert;
                 } signed_entry;
                 CtExtensions  extensions;
             };
         } SignedCertificateTimestamp;
     
    The digitally-signed value is the TLS 1.2 sec. 4.7 form: a one-byte HashAlgorithm and a one-byte SignatureAlgorithm followed by a two-byte-length-prefixed opaque signature. This class exposes the algorithm pair and the raw signature bytes; computing the signed leaf structure and verifying it against a log's public key is a higher-level concern handled outside this decode-only API.

    For RFC 9162 (CT v2), see SignedCertificateTimestampDataV2.

    • Constructor Summary

      Constructors 
      Constructor Description
      SignedCertificateTimestamp​(int sctVersion, byte[] logID, long timestamp, byte[] extensions, int hashAlgorithm, int signatureAlgorithm, byte[] signature)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] getEncoded()
      Serialize this SCT to its TLS wire form (the bytes that would be carried as one SerializedSCT entry in a list).
      byte[] getExtensions()
      The extensions opaque blob carried in the SCT.
      int getHashAlgorithm()
      TLS HashAlgorithm byte (sha256 = 4, etc.).
      static SignedCertificateTimestamp getInstance​(byte[] encoded)
      Decode an SCT from its serialized TLS form (the bytes that appear as one SerializedSCT entry inside a SignedCertificateTimestampList).
      byte[] getLogID()
      32-byte log identifier (SHA-256 of the log's DER-encoded public key).
      int getSctVersion()
      SCT version byte.
      byte[] getSignature()
      Raw signature bytes (the opaque signature field from the digitally-signed struct).
      int getSignatureAlgorithm()
      TLS SignatureAlgorithm byte (rsa = 1, dsa = 2, ecdsa = 3).
      long getTimestamp()
      Issuance timestamp in milliseconds since the Unix epoch (Java convention; the same value the wire form uses).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SignedCertificateTimestamp

        public SignedCertificateTimestamp​(int sctVersion,
                                          byte[] logID,
                                          long timestamp,
                                          byte[] extensions,
                                          int hashAlgorithm,
                                          int signatureAlgorithm,
                                          byte[] signature)
    • Method Detail

      • getSctVersion

        public int getSctVersion()
        SCT version byte. RFC 6962 defines only v1 (0).
      • getLogID

        public byte[] getLogID()
        32-byte log identifier (SHA-256 of the log's DER-encoded public key).
      • getTimestamp

        public long getTimestamp()
        Issuance timestamp in milliseconds since the Unix epoch (Java convention; the same value the wire form uses).
      • getExtensions

        public byte[] getExtensions()
        The extensions opaque blob carried in the SCT. RFC 6962 leaves the contents unspecified; logs in the wild emit it empty.
      • getHashAlgorithm

        public int getHashAlgorithm()
        TLS HashAlgorithm byte (sha256 = 4, etc.).
      • getSignatureAlgorithm

        public int getSignatureAlgorithm()
        TLS SignatureAlgorithm byte (rsa = 1, dsa = 2, ecdsa = 3).
      • getSignature

        public byte[] getSignature()
        Raw signature bytes (the opaque signature field from the digitally-signed struct).
      • getEncoded

        public byte[] getEncoded()
        Serialize this SCT to its TLS wire form (the bytes that would be carried as one SerializedSCT entry in a list).