paulc / dnslib

A Python library to encode/decode DNS wire-format packets
https://github.com/paulc/dnslib
BSD 2-Clause "Simplified" License
295 stars 84 forks source link

Add support for DS, SSHFP, and TLSA records #47

Closed rmbolger closed 1 year ago

rmbolger commented 1 year ago

This change adds RD subclasses for DS (RFC 4034), SSHFP (RFC 4255), and TLSA (RFC 6698) records. They all share very similar structures that begin with a few byte or short values followed by a byte array blob that represents a certificate or hash data presented as hex.

The rdata specific attributes for each type are:

DS

SSHFP

TLSA

I wasn't sure whether it made sense to keep the internal representations of the byte array blobs as byte arrays or store it as the hex strings. But I went with the former using the DNSKEY record as an example even though it uses Base64 for its blob presentation.

I also included at least one test for each type that references publicly available examples of these record types.