aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislav Boboň2021-02-04 10:03:44 +0100
committerStanislav Boboň2021-02-04 10:03:44 +0100
commitfa01b70aeb4e9f6d958398440cc6f6e637926658 (patch)
tree2248fb86fa152d500bfac8bc8878a2e1b3a2cc63
parentbfd91bcd31e4425b419b199ddab23585736ae079 (diff)
downloadsec-certs-fa01b70aeb4e9f6d958398440cc6f6e637926658.tar.gz
sec-certs-fa01b70aeb4e9f6d958398440cc6f6e637926658.tar.zst
sec-certs-fa01b70aeb4e9f6d958398440cc6f6e637926658.zip
optimalized maps
-rw-r--r--sec_certs/cert_rules.py1
-rw-r--r--sec_certs/certificate.py11
-rw-r--r--settings.json4
3 files changed, 13 insertions, 3 deletions
diff --git a/sec_certs/cert_rules.py b/sec_certs/cert_rules.py
index ae44f2ab..9d7f76b7 100644
--- a/sec_certs/cert_rules.py
+++ b/sec_certs/cert_rules.py
@@ -414,6 +414,7 @@ rules_fips_remove_algorithm_ids = [
r"#\d+, ?#\d+",
r"#?\d+ and #?\d+",
r"label \(#\d+\)",
+ r"[Ll]abel #\d+",
r"\(#\d\)",
r"IETF[25\s]*RFC[26\s]*#\d+", # #3425
r"Bendix Road North #760", # #3325
diff --git a/sec_certs/certificate.py b/sec_certs/certificate.py
index 22cbe212..39156b9c 100644
--- a/sec_certs/certificate.py
+++ b/sec_certs/certificate.py
@@ -495,7 +495,8 @@ class FIPSCertificate(Certificate, ComplexSerializableType):
text_to_parse = text_with_newlines if constants.FIPS_USE_NEWLINES else text
- items_found, fips_text = FIPSCertificate.parse_cert_file(text_to_parse, cert.algorithms)
+ items_found, fips_text = FIPSCertificate.parse_cert_file(FIPSCertificate.find_platforms(text_to_parse),
+ cert.algorithms)
save_modified_cert_file(cert.state.fragment_path.with_suffix('.fips.txt'), fips_text, unicode_error)
@@ -508,6 +509,14 @@ class FIPSCertificate(Certificate, ComplexSerializableType):
return items_found, cert
@staticmethod
+ def find_platforms(text_to_parse: str):
+ pat = re.compile(r"[Mm]odification [Hh]istory(?! \.*)+[\s\S]*? ")
+ for match in pat.finditer(text_to_parse):
+ text_to_parse = text_to_parse.replace(
+ match.group(), 'x' * len(match.group()))
+ return text_to_parse
+
+ @staticmethod
def parse_cert_file_common(text_to_parse: str, whole_text_with_newlines: str,
search_rules: Dict) -> Tuple[Optional[Dict], str]:
# apply all rules
diff --git a/settings.json b/settings.json
index e0c6073b..4527cf09 100644
--- a/settings.json
+++ b/settings.json
@@ -1,7 +1,7 @@
{
"smallest_certificate_id_to_connect": {
"description": "During validation we don't connect certificates with number lower than _this_ to connections",
- "value": 110
+ "value": 60
},
"year_difference_between_validations": {
"description": "During validation we don't connect certificates with validation dates difference higher than _this_",
@@ -9,6 +9,6 @@
},
"use_text_with_newlines_during_parsing": {
"description": "During keyword search, search in text with newlines",
- "value": false
+ "value": true
}
}