Skip to content

Commit

Permalink
Fix FIPS aplgo download column parse.
Browse files Browse the repository at this point in the history
Fixes #419.

Also has an impact on #409.
  • Loading branch information
J08nY committed Jul 4, 2024
1 parent c5b4f3d commit 0a62b68
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/sec_certs/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions src/sec_certs/dataset/fips_algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 0a62b68

Please sign in to comment.