diff options
| author | adamjanovsky | 2021-02-22 16:14:49 +0100 |
|---|---|---|
| committer | GitHub | 2021-02-22 16:14:49 +0100 |
| commit | a017b97a0961b4c1a8b02b583db389643ad10c2c (patch) | |
| tree | 588965e470d5a10075980cbf54c7156a9f515fbf | |
| parent | 6b8c45d7bb81384e1cc41d1ccf338e76c6da36f5 (diff) | |
| parent | fbed16b8c6dca166d53309beda47df3672a275ef (diff) | |
| download | sec-certs-a017b97a0961b4c1a8b02b583db389643ad10c2c.tar.gz sec-certs-a017b97a0961b4c1a8b02b583db389643ad10c2c.tar.zst sec-certs-a017b97a0961b4c1a8b02b583db389643ad10c2c.zip | |
Merge pull request #38 from petrs/cc_serialize_cert_dgst
Serialize digest of the certificate
| -rw-r--r-- | sec_certs/certificate.py | 1 | ||||
| -rw-r--r-- | sec_certs/dataset.py | 4 | ||||
| -rw-r--r-- | test/data/test_cc_oop/toy_dataset.json | 8 |
3 files changed, 7 insertions, 6 deletions
diff --git a/sec_certs/certificate.py b/sec_certs/certificate.py index a3b72a37..c253222c 100644 --- a/sec_certs/certificate.py +++ b/sec_certs/certificate.py @@ -809,6 +809,7 @@ class CommonCriteriaCert(Certificate, ComplexSerializableType): report_pdf_path: Path st_txt_path: Path report_txt_path: Path + errors: List[str] def __init__(self, st_link_ok: bool = True, report_link_ok: bool = True, st_convert_ok: bool = True, report_convert_ok: bool = True, diff --git a/sec_certs/dataset.py b/sec_certs/dataset.py index 56cd3a1b..5018f9e9 100644 --- a/sec_certs/dataset.py +++ b/sec_certs/dataset.py @@ -70,11 +70,11 @@ class Dataset(ABC): def to_dict(self): return {'timestamp': self.timestamp, 'sha256_digest': self.sha256_digest, 'name': self.name, 'description': self.description, - 'n_certs': len(self), 'certs': list(self.certs.values())} + 'n_certs': len(self), 'certs': self.certs} @classmethod def from_dict(cls, dct: Dict): - certs = {x.dgst: x for x in dct['certs']} + certs = {x.dgst: x for x in dct['certs'].values()} dset = cls(certs, Path('./'), dct['name'], dct['description']) if len(dset) != (claimed := dct['n_certs']): logger.error( diff --git a/test/data/test_cc_oop/toy_dataset.json b/test/data/test_cc_oop/toy_dataset.json index b59327ce..ffacaae6 100644 --- a/test/data/test_cc_oop/toy_dataset.json +++ b/test/data/test_cc_oop/toy_dataset.json @@ -13,8 +13,8 @@ "name": "toy dataset", "description": "toy dataset description", "n_certs": 2, - "certs": [ - { + "certs": { + "7ef8227c1aed06bb": { "_type": "CommonCriteriaCert", "status": "active", "category": "Access Control Devices and Systems", @@ -53,7 +53,7 @@ "st_keywords": null } }, - { + "561a012d9a30e960": { "_type": "CommonCriteriaCert", "status": "active", "category": "Access Control Devices and Systems", @@ -95,5 +95,5 @@ "st_keywords": null } } - ] + } }
\ No newline at end of file |
