From dad380cc0943c123dd033f08e3752f6bd405f2ec Mon Sep 17 00:00:00 2001 From: J08nY Date: Thu, 24 Aug 2023 16:31:53 +0200 Subject: Fix CC scheme certificate matching. --- src/sec_certs/model/matching.py | 2 ++ src/sec_certs/sample/cc_certificate_id.py | 9 +++++++++ 2 files changed, 11 insertions(+) (limited to 'src') diff --git a/src/sec_certs/model/matching.py b/src/sec_certs/model/matching.py index b298e316..7e48f878 100644 --- a/src/sec_certs/model/matching.py +++ b/src/sec_certs/model/matching.py @@ -49,6 +49,8 @@ class AbstractMatcher(Generic[CertSubType], ABC): if score < threshold: break # Match cert dgst to entry + matched_is.add(i) + matched_js.add(j) cert = certs[i] entry = matchers[j].entry results[cert.dgst] = entry diff --git a/src/sec_certs/sample/cc_certificate_id.py b/src/sec_certs/sample/cc_certificate_id.py index 3e28dfc8..d6e49718 100644 --- a/src/sec_certs/sample/cc_certificate_id.py +++ b/src/sec_certs/sample/cc_certificate_id.py @@ -115,6 +115,14 @@ class CertificateId: cert_num = int(new_cert_id.split("-")[1]) return f"SERTIT-{cert_num:03}" + def _canonical_nl(self): + new_cert_id = self.clean + if new_cert_id.startswith("CC-"): + new_cert_id = f"NSCIB-{new_cert_id}" + if not new_cert_id.endswith("-CR"): + new_cert_id = f"{new_cert_id}-CR" + return new_cert_id + @property def clean(self) -> str: """ @@ -139,6 +147,7 @@ class CertificateId: "CA": self._canonical_ca, "JP": self._canonical_jp, "NO": self._canonical_no, + "NL": self._canonical_nl, } if self.scheme in schemes: -- cgit v1.3.1