diff --git a/benchmarks/benchmark.py b/benchmarks/benchmark.py index 993c974..0be2919 100644 --- a/benchmarks/benchmark.py +++ b/benchmarks/benchmark.py @@ -27,6 +27,8 @@ def load_schemes(): schemes.existing.IntermediateSuppression(), schemes.existing.ICAAndTLS(), schemes.existing.HypotheticalOptimimum(), + schemes.existing.MetadataEstimate(), + schemes.existing.LeafDomainNames(), # This Draft schemes.abridged.PrefixOnly(), schemes.abridged.PrefixAndZstd(offlineCompression=False), diff --git a/benchmarks/schemes/existing.py b/benchmarks/schemes/existing.py index 6106ecf..55596e0 100644 --- a/benchmarks/schemes/existing.py +++ b/benchmarks/schemes/existing.py @@ -119,3 +119,46 @@ def compress(self, cert_chain): def decompress(self, compressed_data): # Not defined. pass + + +class MetadataEstimate: + def __init__(self): + pass + + def name(self): + return "Leaf Certificate Metadata Estimate" + + def footprint(self): + return 0 + + def compress(self, cert_chain): + + (d, pk, s) = extract_subject_info(cert_chain[0]) + compressed_domains = zstandard.compress(d, 22) + # Size Estimate := Certificate - pk - sig with compressed_domains and no SCTs. + size_estimate = len(cert_chain[0]) - len(d) - len(pk) - len(s) + len(compressed_domains) + size_estimate -= sum([len(x.signature) + len(x.log_id) for x in extract_scts(cert_chain[0])]) + return b"x" * size_estimate + + def decompress(self, compressed_data): + # Not defined. + pass + +class LeafDomainNames: + def __init__(self): + pass + + def name(self): + return "Leaf Certificate Compressed Domains Estimate" + + def footprint(self): + return 0 + + def compress(self, cert_chain): + (d, pk, s) = extract_subject_info(cert_chain[0]) + compressed_domains = zstandard.compress(d, 22) + return compressed_domains + + def decompress(self, compressed_data): + # Not defined. + pass \ No newline at end of file