Class MTCLogEntry
java.lang.Object
org.bouncycastle.cert.plants.MTCLogEntry
- Direct Known Subclasses:
MerkleTreeCertEntry
Parses (and encodes) a single log entry per Section 5.2.1 of
draft-ietf-plants-merkle-tree-certs:
struct {
MTCLogEntryExtension extensions<0..2^16-1>;
MTCLogEntryType type;
select (type) {
case null_entry: Empty;
case tbs_cert_entry: opaque tbs_cert_entry_data[N];
}
} MTCLogEntry;
draft-06 renamed this structure from MerkleTreeCertEntry to
MTCLogEntry; the deprecated MerkleTreeCertEntry is the old
name. The encoding is unchanged.
For tbs_cert_entry, the body is the DER contents octets
of a TBSCertificateLogEntry — that is, the SEQUENCE tag and length
octets are stripped. getTbsCertEntry() reattaches a DER SEQUENCE
wrapper and decodes it for callers who want the structured form.
MTCLogEntry is parsed in a length-framed context (the
caller knows how many bytes belong to it); the byte-array constructor
therefore consumes its full input.
-
Constructor Summary
ConstructorsConstructorDescriptionMTCLogEntry(byte[] data) Parses aMTCLogEntryfrom its TLS wire encoding.MTCLogEntry(List<? extends MTCLogEntryExtension> extensions, int type, byte[] body) Constructs an entry from its component parts. -
Method Summary
-
Constructor Details
-
MTCLogEntry
Constructs an entry from its component parts.- Parameters:
extensions- ordered (ascendingextension_type, no duplicates)type- aMTCLogEntryTypevalue (uint16)body- the type-specific body bytes (empty fornull_entry, thetbs_cert_entry_datacontents fortbs_cert_entry)
-
MTCLogEntry
Parses aMTCLogEntryfrom its TLS wire encoding. The input MUST contain exactly one entry; trailing bytes are rejected.- Throws:
IOException
-
-
Method Details
-
getExtensions
-
getType
public int getType() -
getBody
public byte[] getBody()- Returns:
- the type-specific body bytes — empty for
null_entry, thetbs_cert_entry_datacontents (DER body of a TBSCertificateLogEntry without its SEQUENCE wrapper) fortbs_cert_entry, or the raw bytes for any future type
-
getTbsCertEntry
Reattaches a DER SEQUENCE wrapper togetBody()and decodes the result as aTBSCertificateLogEntry.- Throws:
IllegalStateException- ifgetType()is nottbs_cert_entryIOException- if the wrapped bytes do not decode as a TBSCertificateLogEntry
-
encode
- Returns:
- the TLS wire encoding of this entry
- Throws:
IOException- if a length constraint is violated
-