From 0a62b68777936510c9784b813c83c47734daf948 Mon Sep 17 00:00:00 2001 From: J08nY Date: Thu, 4 Jul 2024 16:45:11 +0200 Subject: [PATCH] Fix FIPS aplgo download column parse. Fixes #419. Also has an impact on #409. --- src/sec_certs/constants.py | 4 +++- src/sec_certs/dataset/fips_algorithm.py | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sec_certs/constants.py b/src/sec_certs/constants.py index 71c79f3e..e9b6d882 100644 --- a/src/sec_certs/constants.py +++ b/src/sec_certs/constants.py @@ -32,7 +32,9 @@ FIPS_CMVP_URL = FIPS_BASE_URL + "/projects/cryptographic-module-validation-program" FIPS_CAVP_URL = FIPS_BASE_URL + "/projects/Cryptographic-Algorithm-Validation-Program" FIPS_MODULE_URL = FIPS_CMVP_URL + "/certificate/{}" -FIPS_ALG_SEARCH_URL = FIPS_CAVP_URL + "/validation-search?searchMode=validation&page=" +FIPS_ALG_SEARCH_VALIDATION_URL = FIPS_CAVP_URL + "/validation-search?searchMode=validation&page=" +FIPS_ALG_SEARCH_IMPLEMENTATION_URL = FIPS_CAVP_URL + "/validation-search?searchMode=implementation&page=" +FIPS_ALG_SEARCH_URL = FIPS_ALG_SEARCH_VALIDATION_URL FIPS_SP_URL = "https://csrc.nist.gov/CSRC/media/projects/cryptographic-module-validation-program/documents/security-policies/140sp{}.pdf" FIPS_ACTIVE_MODULES_URL = ( FIPS_CMVP_URL + "/validated-modules/search?SearchMode=Advanced&CertificateStatus=Active&ValidationYear=0" diff --git a/src/sec_certs/dataset/fips_algorithm.py b/src/sec_certs/dataset/fips_algorithm.py index 4a87b3ef..56163078 100644 --- a/src/sec_certs/dataset/fips_algorithm.py +++ b/src/sec_certs/dataset/fips_algorithm.py @@ -96,6 +96,9 @@ def get_number_of_html_pages(html_path: Path) -> int: @staticmethod def parse_algorithms_from_html(html_path: Path) -> set[FIPSAlgorithm]: df = pd.read_html(html_path)[0] + for col in df.columns: + if "Order by" in col: + df.rename(columns={col: col.split("Order by")[0]}, inplace=True) df["alg_type"] = df["Validation Number"].map(lambda x: re.sub(r"[0-9\s]", "", x)) df["alg_number"] = df["Validation Number"].map(lambda x: re.sub(r"[^0-9]", "", x)) df["alg"] = df.apply(