Interfaces

Here is a list of interfaces (i.e. Parser s) implemented as defined in the specification. When you are working with them, it might sometimes be helpful to check out the result of their print() method. For example, calling this on a BikeshedCertificate produces

--------------------Struct BikeshedCertificate (780)--------------------
        --------------------Struct Assertion (109)--------------------
                2 SubjectType tls(0)
                34 SubjectInfo ..X.....z.X.Q.....(.1....y....]`
                --------------------Vector ClaimList (73)--------------------
                        2 ClaimType dns(0)
                                --------------------Vector DNSNameList (21)--------------------
                                        19 DNSName www.cloudflare.com
                                ------------------End vector DNSNameList------------------
                        2 ClaimType ipv4(2)
                                --------------------Vector IPv4AddressList (10)--------------------
                                        4 IPv4Address 1.0.0.1
                                        4 IPv4Address 1.1.1.1
                                ------------------End vector IPv4AddressList------------------
                        2 ClaimType ipv6(3)
                                --------------------Vector IPv6AddressList (34)--------------------
                                        16 IPv6Address 2606:4700:4700::1001
                                        16 IPv6Address 2606:4700:4700::1111
                                ------------------End vector IPv6AddressList------------------
                ------------------End vector ClaimList------------------
        ------------------End struct Assertion------------------
        --------------------Struct Proof (671)--------------------
                --------------------Struct TrustAnchor (19)--------------------
                        2 ProofType merkle_tree_sha256(0)
                        --------------------Struct MerkleTreeTrustAnchor (17)--------------------
                                12 IssuerID test.issuer
                                4 UInt32 8
                        ------------------End struct MerkleTreeTrustAnchor------------------
                ------------------End struct TrustAnchor------------------
                --------------------Struct MerkleTreeProofSHA256 (652)--------------------
                        8 UInt64 25
                        --------------------Vector SHA256Vector (642)--------------------
                                32 Array SHA256Hash .......<-1.$..6..l......[......(
                                32 Array SHA256Hash 6.v.e......%`S..j.9PL#..~......u
                                32 Array SHA256Hash .`<.?3...ZH.+.t.hn..2......HN..Q
                                32 Array SHA256Hash ......A.*........JJ@9..4.o....e.
                                32 Array SHA256Hash ...$.sAV..Z..}((..`....~x.qRZ5.$
                                32 Array SHA256Hash 7..t.LL...Vy7.........r...@..6.@
                                32 Array SHA256Hash .B`.O.....a.g.C:D.KC+..Y5.#fx..A
                                32 Array SHA256Hash .x.X..q....cF"b....RG.S......N|W
                                32 Array SHA256Hash ..w.jP=(v.bT.l*.!....P......#=;3
                                32 Array SHA256Hash ..../N".c$.H;#.h&0..............
                                32 Array SHA256Hash TP..G.,.,.-.^".k..6qE..b.1..6..M
                                32 Array SHA256Hash ...F\{,f.n*_..W.......e.F.^."..v
                                32 Array SHA256Hash 53...y...rf.(",..[=[:...\l.....4
                                32 Array SHA256Hash .f.."".,.:q......=gj...^..../..4
                                32 Array SHA256Hash ..'/...Y.B)-.b(H@.+.=..G.._J*.R.
                                32 Array SHA256Hash &.V...(..l.?[.5...I[.z...!....Am
                                32 Array SHA256Hash 5.r2=.-..s}.b...........P_.|.5~F
                                32 Array SHA256Hash ....>...3t....~'..-..O..&.@..L.W
                                32 Array SHA256Hash .!..&$8..br%..............1.2...
                                32 Array SHA256Hash .L..0um.o..&$.u..Al.?.R.%..T..J.
                        ------------------End vector SHA256Vector------------------
                ------------------End struct MerkleTreeProofSHA256------------------
        ------------------End struct Proof------------------
------------------End struct BikeshedCertificate------------------

The following interfaces are implemented

class mtc.ip.IPv4Address(value: str | bytes)[source]

Bases: Parser

class mtc.ip.IPv6Address(value: str | bytes)[source]

Bases: Parser

class mtc.assertion.IPv4AddressList(*value: IPv4Address)[source]

Bases: Vector

Implemented according to section 4.2 of the specification

data_type

alias of IPv4Address

min_length: int = 4
max_length: int = 65535
class mtc.assertion.IPv6AddressList(*value: IPv6Address)[source]

Bases: Vector

Implemented according to section 4.2 of the specification

data_type

alias of IPv6Address

min_length: int = 16
max_length: int = 65535
class mtc.assertion.SubjectType(value: int)[source]

Bases: Enum

Implemented according to section 4 of the specification

tls: SubjectType = <SubjectType 0>
class mtc.assertion.ClaimType(value: int)[source]

Bases: Enum

dns: ClaimType = <ClaimType 0>
dns_wildcard: ClaimType = <ClaimType 1>
ipv4: ClaimType = <ClaimType 2>
ipv6: ClaimType = <ClaimType 3>
class mtc.assertion.DNSName(value: bytes)[source]

Bases: OpaqueVector

Implemented according to section 4.1 of the specification

min_length: int = 1
max_length: int = 255
class mtc.assertion.DNSNameList(*value: DNSNameList)[source]

Bases: Vector

Implemented according to section 4.1 of the specification

data_type

alias of DNSName

min_length: int = 1
max_length: int = 65535
class mtc.assertion.SubjectInfo(value: bytes)[source]

Bases: OpaqueVector

Implemented according to section 4 of the specification

min_length: int = 1
max_length: int = 65535
class mtc.assertion.Claim(value:tuple[ClaimType, DNSNameList|IPv4AddressList|IPv6AddressList]))[source]

Bases: Variant

Implemented according to section 4 of the specification

class mtc.assertion.ClaimList(value: bytes)[source]

Bases: Vector

Implemented according to section 4 of the specification

class mtc.assertion.Assertion(*value: tuple[SubjectType, SubjectInfo, ClaimList])[source]

Bases: Struct

Implemented according to section 4 of the specification

subject_type: SubjectType
subject_info: SubjectInfo
claims: ClaimList
class mtc.assertion.Assertions(*value: Assertion)[source]

Bases: Vector

Implemented according to section 5.4.2 of the specification

data_type

alias of Assertion

min_length: int = 0
max_length: int = 18446744073709551615
class mtc.tree.Distinguisher(value: int)[source]

Bases: Enum

Implemented according to section 5.4.1 of the specification

HashEmptyInput: Distinguisher = <Distinguisher 0>
HashNodeInput: Distinguisher = <Distinguisher 1>
HashAssertionInput: Distinguisher = <Distinguisher 2>
class mtc.tree.SHA256Hash(*value: bytes)[source]

Bases: Array

Implemented according to section 5.4.1 of the specification

length: int = 32
class mtc.tree.IssuerID(*value: bytes)[source]

Bases: OpaqueVector

Implemented according to section 5.4.2 of the specification

min_length: int = 0
max_length: int = 32
class mtc.tree.HashHead(value: tuple[Distinguisher, IssuerID, UInt32])[source]

Bases: Parser

Implemented according to section 5.4.1 of the specification

to_bytes() bytes[source]
classmethod parse(stream: BufferedIOBase) Self[source]
print() str[source]
class mtc.tree.HashEmptyInput(*value: tuple[HashHead, UInt64, UInt8])[source]

Bases: Struct

Implemented according to section 5.4.1 of the specification

hash_head: HashHead
index: UInt64
level: UInt8
class mtc.tree.HashNodeInput(*value: tuple[HashHead, UInt64, UInt8, SHA256Hash, SHA256Hash])[source]

Bases: Struct

Implemented according to section 5.4.1 of the specification

hash_head: HashHead
index: UInt64
level: UInt8
left: SHA256Hash
right: SHA256Hash
class mtc.tree.HashAssertionInput(*value: tuple[HashHead, UInt64, Assertion])[source]

Bases: Struct

Implemented according to section 5.4.1 of the specification

hash_head: HashHead
index: UInt64
assertion: Assertion
class mtc.certificate.TreeHeads(value: list[SHA256Hash])[source]

Bases: Parser

Implemented according to section 5.4.2 of the specification

to_bytes() bytes[source]
classmethod parse(stream: BufferedIOBase) Self[source]
validate() None[source]
class mtc.certificate.ValidityWindow(*value: tuple[UInt32, TreeHeads])[source]

Bases: Struct

Implemented according to section 5.4.2 of the specification

batch_number: UInt32
tree_heads: TreeHeads
class mtc.certificate.ValidityWindowLabel(value: bytes = b'Merkle Tree Crts ValidityWindow\x00')[source]

Bases: Parser

Implemented according to section 5.4.2 of the specification

to_bytes() bytes[source]
classmethod parse(stream: BufferedIOBase) Self[source]
validate() None[source]
class mtc.certificate.LabeledValidityWindow(*value: tuple[ValidityWindowLabel, IssuerID, ValidityWindow])[source]

Bases: Struct

Implemented according to section 5.4.2 of the specification

label: ValidityWindowLabel
issuer_id: IssuerID
window: ValidityWindow
class mtc.certificate.Signature(value: bytes)[source]

Bases: OpaqueVector

Implemented according to section 5.4.2 of the specification

min_length: int = 1
max_length: int = 65535
class mtc.certificate.SignedValidityWindow(*value: tuple[ValidityWindow, Signature])[source]

Bases: Struct

Implemented according to section 5.4.2 of the specification

window: ValidityWindow
signature: Signature
class mtc.certificate.ProofType(value: int)[source]

Bases: Enum

Implemented according to section 5.4.3 of the specification

merkle_tree_sha256: ProofType = <ProofType 0>
class mtc.certificate.SHA256Vector(*value: tuple[SHA256Hash])[source]

Bases: Vector

Implemented according to section 5.4.3 of the specification

data_type

alias of SHA256Hash

min_length: int = 0
max_length: int = 65535
class mtc.certificate.TrustAnchorData(value: bytes)[source]

Bases: OpaqueVector

Implemented according to section 5.4.3 of the specification

min_length: int = 0
max_length: int = 255
class mtc.certificate.ProofData(value: bytes)[source]

Bases: OpaqueVector

Implemented according to section 5.4.3 of the specification

min_length: int = 0
max_length: int = 65535
class mtc.certificate.MerkleTreeTrustAnchor(*value: tuple[IssuerID, UInt32])[source]

Bases: Struct

Implemented according to section 5.4.3 of the specification

issuer_id: IssuerID
batch_number: UInt32
to_bytes() bytes[source]
class mtc.certificate.MerkleTreeProofSHA256(*value: tuple[UInt64, SHA256Vector])[source]

Bases: Struct

Implemented according to section 5.4.3 of the specification

index: UInt64
path: SHA256Vector
to_bytes() bytes[source]
class mtc.certificate.TrustAnchor(*value: tuple[ProofType, TrustAnchorData | MerkleTreeTrustAnchor])[source]

Bases: Struct

Implemented according to section 5.4.3 of the specification

proof_type: ProofType
trust_anchor_data: TrustAnchorData | MerkleTreeTrustAnchor
classmethod skip(stream: BufferedIOBase) None[source]
class mtc.certificate.Proof(*value: tuple[TrustAnchor, ProofData | MerkleTreeProofSHA256])[source]

Bases: Struct

Implemented according to section 5.4.3 of the specification

trust_anchor: TrustAnchor
proof_data: ProofData | MerkleTreeProofSHA256
classmethod parse(stream: BufferedIOBase) Self[source]
classmethod skip(stream: BufferedIOBase) None[source]
class mtc.certificate.BikeshedCertificate(*value: tuple[Assertion, Proof])[source]

Bases: Struct

Implemented according to section 5.4.3 of the specification

assertion: Assertion
proof: Proof