aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormmstanone2021-08-05 15:39:41 +0200
committermmstanone2021-08-05 15:39:41 +0200
commit3564cb3c0d39e7d2cc5d0bb46d2e9e1f8802f4f8 (patch)
treed60dc09c6cdd6e63fde2f942cec31aa6314a725c
parent82389fe8d5f4a1060dbacdd5cc48e765ae69428b (diff)
downloadsec-certs-3564cb3c0d39e7d2cc5d0bb46d2e9e1f8802f4f8.tar.gz
sec-certs-3564cb3c0d39e7d2cc5d0bb46d2e9e1f8802f4f8.tar.zst
sec-certs-3564cb3c0d39e7d2cc5d0bb46d2e9e1f8802f4f8.zip
Working CLI
-rwxr-xr-xfips_cli.py2
-rw-r--r--sec_certs/dataset/fips.py6
-rw-r--r--sec_certs/dataset/fips_algorithm.py1
3 files changed, 6 insertions, 3 deletions
diff --git a/fips_cli.py b/fips_cli.py
index 25a57957..adf84392 100755
--- a/fips_cli.py
+++ b/fips_cli.py
@@ -189,6 +189,8 @@ def main(
assert inputpath
dset: FIPSDataset = FIPSDataset.from_json(inputpath)
+
+ print(f'Have dataset with {len(dset)} certs and {len(dset.algorithms)} algorithms.')
if output:
print(
"Warning: You provided both inputpath and outputpath, dataset will be copied to outputpath (without data)"
diff --git a/sec_certs/dataset/fips.py b/sec_certs/dataset/fips.py
index 0dbfb324..39cb1a92 100644
--- a/sec_certs/dataset/fips.py
+++ b/sec_certs/dataset/fips.py
@@ -89,6 +89,10 @@ class FIPSDataset(Dataset, ComplexSerializableType):
output = {}
cert: FIPSCertificate
for cert in self.certs.values():
+ # if the pdf has not been processed, no matching can be done
+ if not cert.pdf_scan.keywords or not cert.state.txt_state:
+ continue
+
output[cert.dgst] = FIPSCertificate.match_web_algs_to_pdf(cert)
cert.processed.unmatched_algs = output[cert.dgst]
@@ -270,8 +274,6 @@ class FIPSDataset(Dataset, ComplexSerializableType):
for state, cert, algorithms in result:
self.certs[cert.dgst].state.tables_done = state
self.certs[cert.dgst].pdf_scan.algorithms += algorithms
-
- self.match_algs()
return not_decoded
def remove_algorithms_from_extracted_data(self):
diff --git a/sec_certs/dataset/fips_algorithm.py b/sec_certs/dataset/fips_algorithm.py
index 89b4e4df..0fd39ab0 100644
--- a/sec_certs/dataset/fips_algorithm.py
+++ b/sec_certs/dataset/fips_algorithm.py
@@ -105,7 +105,6 @@ class FIPSAlgorithmDataset(Dataset, ComplexSerializableType):
return dset
def to_dict(self):
- print(self.__dict__)
return self.__dict__
def to_json(self, output_path: Union[str, Path]):