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

Adding DKIM signature raises TXT record too long #34

Closed Ashiq5 closed 2 years ago

Ashiq5 commented 2 years ago

If I want to add a DKIM signature as a RR for a domain, it raises the following stack trace. In BIND/ NSD, one can separate the TXT record in quotes to accommodate this case. But what's the workaround for this in dnslib?

Traceback (most recent call last):
  File "ddns.py", line 56, in <module>
    D._domainkey.mail: [TXT(DKIM)],
  File "python3.8/site-packages/dnslib/dns.py", line 1114, in __init__
    raise DNSError("TXT record too long: %s" % self.data)
Ashiq5 commented 2 years ago

Passing an array of strings to the TXT record constructor, with each string less than 255 characters, solves this issue.