Skip to content

Commit

Permalink
Add schemes for estimating leaf certificate composition
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis Jackson committed Sep 26, 2024
1 parent e56de4e commit 26fa613
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
2 changes: 2 additions & 0 deletions benchmarks/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
43 changes: 43 additions & 0 deletions benchmarks/schemes/existing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 26fa613

Please sign in to comment.