diff options
Diffstat (limited to 'sec_certs/sample/fips_algorithm.py')
| -rw-r--r-- | sec_certs/sample/fips_algorithm.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/sec_certs/sample/fips_algorithm.py b/sec_certs/sample/fips_algorithm.py new file mode 100644 index 00000000..fcfd42b6 --- /dev/null +++ b/sec_certs/sample/fips_algorithm.py @@ -0,0 +1,31 @@ +from dataclasses import dataclass + +from sec_certs import constants +from sec_certs.serialization.json import ComplexSerializableType + + +@dataclass(eq=True) +class FIPSAlgorithm(ComplexSerializableType): + """ + Data structure for algorithm of `FIPSCertificate` + """ + + cert_id: int + vendor: str + implementation: str + algorithm_type: str + date: str + + @property + def dgst(self) -> str: + return f"{self.algorithm_type}#{self.cert_id}" + + @property + def page_url(self) -> str: + return constants.FIPS_ALG_URL.format(self.algorithm_type, self.cert_id) + + def __repr__(self) -> str: + return f"FIPSAlgorithm({self.dgst})" + + def __str__(self) -> str: + return f"{self.algorithm_type} algorithm # {self.cert_id} created by {self.vendor}" |
