diff options
| author | 2025-04-10 05:29:27 -0400 | |
|---|---|---|
| committer | 2025-04-10 05:29:27 -0400 | |
| commit | b10c92e14e6bc28dfd5e7ca235fc4a2a521f8272 (patch) | |
| tree | bd679d9c6618668477647b4b8fc9b3e371231402 /pkb_client/client/dnssec.py | |
| parent | 3e3ebe586385a83b10c8f1d0b9ba9b67c8b56d2f (diff) | |
New upstream version 2.1.1.upstream/2.1.1
Diffstat (limited to 'pkb_client/client/dnssec.py')
| -rw-r--r-- | pkb_client/client/dnssec.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/pkb_client/client/dnssec.py b/pkb_client/client/dnssec.py new file mode 100644 index 0000000..2f68ecb --- /dev/null +++ b/pkb_client/client/dnssec.py @@ -0,0 +1,35 @@ +from dataclasses import dataclass +from typing import Optional + + +@dataclass +class DNSSECRecord: + key_tag: int # The key tag is a 16-bit integer that identifies the DNSKEY record + alg: int # Indicates the algorithm used to generate the public key + digest_type: int # Indicates the type of digest algorithm used + digest: str # The digest of the public key + max_sig_life: Optional[ + int + ] # Indicates the amount of time in seconds the signature is valid + key_data_flags: Optional[ + int + ] # Indicates the key type (Zone-signing or Key-signing) + key_data_protocol: Optional[int] # Indicates the protocol used for the key + key_data_algo: Optional[int] # Indicates the algorithm used for the key + key_data_pub_key: Optional[str] # The public key in base64 format + + @staticmethod + def from_dict(d): + return DNSSECRecord( + key_tag=int(d["keyTag"]), + alg=int(d["alg"]), + digest_type=int(d["digestType"]), + digest=d["digest"], + max_sig_life=int(d["maxSigLife"]) if "maxSigLife" in d else None, + key_data_flags=int(d["keyDataFlags"]) if "keyDataFlags" in d else None, + key_data_protocol=int(d["keyDataProtocol"]) + if "keyDataProtocol" in d + else None, + key_data_algo=int(d["keyDataAlgo"]) if "keyDataAlgo" in d else None, + key_data_pub_key=d["keyDataPubKey"] if "keyDataPubKey" in d else None, + ) |
