Package org.bouncycastle.cert.plants
Class MerkleTreeCertEntry
- java.lang.Object
-
- org.bouncycastle.cert.plants.MerkleTreeCertEntry
-
public class MerkleTreeCertEntry extends java.lang.ObjectParses (and encodes) a single log entry per Section 5.2.1 of draft-ietf-plants-merkle-tree-certs:struct { MerkleTreeCertEntryExtension extensions<0..2^16-1>; MerkleTreeCertEntryType type; select (type) { case null_entry: Empty; case tbs_cert_entry: opaque tbs_cert_entry_data[N]; } } MerkleTreeCertEntry;For
tbs_cert_entry, the body is the DER contents octets of aTBSCertificateLogEntry— 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.MerkleTreeCertEntryis 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
Constructors Constructor Description MerkleTreeCertEntry(byte[] data)Parses aMerkleTreeCertEntryfrom its TLS wire encoding.MerkleTreeCertEntry(java.util.List<MerkleTreeCertEntryExtension> extensions, int type, byte[] body)Constructs an entry from its component parts.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]encode()byte[]getBody()java.util.List<MerkleTreeCertEntryExtension>getExtensions()org.bouncycastle.asn1.x509.TBSCertificateLogEntrygetTbsCertEntry()Reattaches a DER SEQUENCE wrapper togetBody()and decodes the result as aTBSCertificateLogEntry.intgetType()
-
-
-
Constructor Detail
-
MerkleTreeCertEntry
public MerkleTreeCertEntry(java.util.List<MerkleTreeCertEntryExtension> extensions, int type, byte[] body)
Constructs an entry from its component parts.- Parameters:
extensions- ordered (ascendingextension_type, no duplicates)type- aMerkleTreeCertEntryTypevalue (uint16)body- the type-specific body bytes (empty fornull_entry, thetbs_cert_entry_datacontents fortbs_cert_entry)
-
MerkleTreeCertEntry
public MerkleTreeCertEntry(byte[] data) throws java.io.IOExceptionParses aMerkleTreeCertEntryfrom its TLS wire encoding. The input MUST contain exactly one entry; trailing bytes are rejected.- Throws:
java.io.IOException
-
-
Method Detail
-
getExtensions
public java.util.List<MerkleTreeCertEntryExtension> 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
public org.bouncycastle.asn1.x509.TBSCertificateLogEntry getTbsCertEntry() throws java.io.IOExceptionReattaches a DER SEQUENCE wrapper togetBody()and decodes the result as aTBSCertificateLogEntry.- Throws:
java.lang.IllegalStateException- ifgetType()is nottbs_cert_entryjava.io.IOException- if the wrapped bytes do not decode as a TBSCertificateLogEntry
-
encode
public byte[] encode() throws java.io.IOException- Returns:
- the TLS wire encoding of this entry
- Throws:
java.io.IOException- if a length constraint is violated
-
-