public class MTCProof
extends java.lang.Object
struct {
TrustAnchorID cosigner_id;
opaque signature<0..2^16-1>;
} Cosignature;
struct {
MTCLogEntryExtension extensions<0..2^16-1>;
uint48 start;
uint48 end;
opaque inclusion_proof<0..2^16-1>;
Cosignature signatures<0..2^24-1>;
} MTCProof;
extensions carries the log entry's extension list, ordered by
extension_type ascending with no duplicates. start and
end are 6-byte unsigned big-endian integers. inclusion_proof
is the proof's hashes concatenated in order. signatures carries a
3-byte length prefix (draft-06 widened it from 2 bytes); its entries, each an
MTCCosignature, MUST have unique cosigner_ids and MUST be
ordered first by length (shorter byte strings before longer) and then
lexicographically. A cosigner ID the relying party does not recognise is
ignored, which is what lets a CA include GREASE cosignatures (RFC 8701) with
an unused ID and arbitrary signature bytes.
| Modifier and Type | Field and Description |
|---|---|
static long |
UINT48_MAX
Maximum value of a uint48 (2^48 - 1).
|
| Constructor and Description |
|---|
MTCProof(byte[] data)
Parses an MTCProof from its TLS wire encoding (the contents of the
certificate's
signatureValue BIT STRING, byte-aligned, with no
unused-bits prefix). |
MTCProof(java.util.List<? extends MTCLogEntryExtension> extensions,
long start,
long end,
byte[] inclusionProof,
java.util.List<? extends MTCCosignature> signatures)
Constructs an MTCProof, validating uint48 range, ordering of the
extensions list (ascending by extension_type, no duplicates) and
canonical ordering of the signatures list.
|
MTCProof(long start,
long end,
byte[] inclusionProof,
java.util.List<? extends MTCCosignature> signatures)
Constructs an MTCProof with an empty extensions list.
|
MTCProof(long start,
long end,
byte[] inclusionProof,
MTCCosignature... signatures)
Varargs convenience for the common case of constructing an MTCProof from
a small fixed set of cosigner signatures (typically just one).
|
MTCProof(MTCLog log,
byte[] inclusionProof,
MTCCosignature... signatures)
Convenience overload taking an
MTCLog — equivalent to
MTCProof(long, long, byte[], MTCCosignature...) with
start = log.getStart() and end = log.getEnd(). |
| Modifier and Type | Method and Description |
|---|---|
static int |
compareCosignerIds(byte[] a,
byte[] b)
The canonical comparator on cosigner_id byte strings, per Section 6.2:
shorter byte strings come first, ties are broken lexicographically
(unsigned).
|
byte[] |
encode() |
long |
getEnd() |
java.util.List<MTCLogEntryExtension> |
getExtensions() |
byte[] |
getExtensionsWire() |
java.util.List<byte[]> |
getHashList(int hashSize)
Splits the concatenated
inclusion proof into
individual hash values of the given size. |
byte[] |
getInclusionProof() |
java.util.List<MTCCosignature> |
getSignatures() |
long |
getStart() |
public static final long UINT48_MAX
public MTCProof(long start,
long end,
byte[] inclusionProof,
java.util.List<? extends MTCCosignature> signatures)
MTCProof(List, long, long, byte[], List)public MTCProof(long start,
long end,
byte[] inclusionProof,
MTCCosignature... signatures)
MTCProof(long, long, byte[], List) with the signatures wrapped
in a list; the same ordering rules in Section 6.2 apply.public MTCProof(MTCLog log, byte[] inclusionProof, MTCCosignature... signatures)
MTCLog — equivalent to
MTCProof(long, long, byte[], MTCCosignature...) with
start = log.getStart() and end = log.getEnd().public MTCProof(java.util.List<? extends MTCLogEntryExtension> extensions, long start, long end, byte[] inclusionProof, java.util.List<? extends MTCCosignature> signatures)
java.lang.IllegalArgumentException - if start or end exceeds 2^48-1, if the
extensions are unordered or duplicate,
or if the signatures contain a duplicate
cosigner_id or are not in canonical orderpublic MTCProof(byte[] data)
throws java.io.IOException
signatureValue BIT STRING, byte-aligned, with no
unused-bits prefix).java.io.IOException - if parsing fails or if the extensions / signatures
lists violate the ordering rules in Section 6.2public byte[] encode()
throws java.io.IOException
java.io.IOException - if a length constraint is violatedpublic long getStart()
public long getEnd()
public byte[] getInclusionProof()
public java.util.List<MTCCosignature> getSignatures()
public java.util.List<MTCLogEntryExtension> getExtensions()
public byte[] getExtensionsWire()
extensions field, including
the 2-byte length prefix; equal to the leading bytes of
encode(). Section 7.2 step (5.2) requires these bytes to
be written into the leaf-entry hash unchanged.public java.util.List<byte[]> getHashList(int hashSize)
inclusion proof into
individual hash values of the given size.public static int compareCosignerIds(byte[] a,
byte[] b)