Package org.bouncycastle.cert.ct
Class SignedCertificateTimestamp
- java.lang.Object
-
- org.bouncycastle.cert.ct.SignedCertificateTimestamp
-
public class SignedCertificateTimestamp extends java.lang.ObjectA single Signed Certificate Timestamp (SCT) in the RFC 6962 (CT v1) wire format. Decoded from the TLS-encoded payload of aSignedCertificateTimestampList.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;Thedigitally-signedvalue 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.
-
-
Field Summary
Fields Modifier and Type Field Description static intLOG_ID_LENGTHstatic intVERSION_V1
-
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 oneSerializedSCTentry in a list).byte[]getExtensions()Theextensionsopaque blob carried in the SCT.intgetHashAlgorithm()TLS HashAlgorithm byte (sha256 = 4, etc.).static SignedCertificateTimestampgetInstance(byte[] encoded)Decode an SCT from its serialized TLS form (the bytes that appear as oneSerializedSCTentry inside aSignedCertificateTimestampList).byte[]getLogID()32-byte log identifier (SHA-256 of the log's DER-encoded public key).intgetSctVersion()SCT version byte.byte[]getSignature()Raw signature bytes (the opaque signature field from the digitally-signed struct).intgetSignatureAlgorithm()TLS SignatureAlgorithm byte (rsa = 1, dsa = 2, ecdsa = 3).longgetTimestamp()Issuance timestamp in milliseconds since the Unix epoch (Java convention; the same value the wire form uses).
-
-
-
Field Detail
-
LOG_ID_LENGTH
public static final int LOG_ID_LENGTH
- See Also:
- Constant Field Values
-
VERSION_V1
public static final int VERSION_V1
- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static SignedCertificateTimestamp getInstance(byte[] encoded)
Decode an SCT from its serialized TLS form (the bytes that appear as oneSerializedSCTentry inside aSignedCertificateTimestampList).
-
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()
Theextensionsopaque 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 oneSerializedSCTentry in a list).
-
-