]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Adds SMIMEA record type, RFC 8162 578/head
authorNils Wisiol <mail@nils-wisiol.de>
Thu, 27 Aug 2020 07:47:02 +0000 (09:47 +0200)
committerNils Wisiol <mail@nils-wisiol.de>
Thu, 27 Aug 2020 07:49:46 +0000 (09:49 +0200)
dns/rdatatype.py
dns/rdtypes/ANY/SMIMEA.py [new file with mode: 0644]
dns/rdtypes/ANY/__init__.py
doc/rdata-subclasses.rst
doc/rdatatype-list.rst
doc/rfc.rst
tests/example
tests/example1.good
tests/example2.good
tests/example3.good
tests/test_rdata.py

index a6b5d649988066df66926ff3c9861764cac55711..65da6d4ef5b88e5cf9d9c0188ec846efd4b2869b 100644 (file)
@@ -72,6 +72,7 @@ class RdataType(dns.enum.IntEnum):
     NSEC3 = 50
     NSEC3PARAM = 51
     TLSA = 52
+    SMIMEA = 53
     HIP = 55
     NINFO = 56
     CDS = 59
@@ -272,6 +273,7 @@ DHCID = RdataType.DHCID
 NSEC3 = RdataType.NSEC3
 NSEC3PARAM = RdataType.NSEC3PARAM
 TLSA = RdataType.TLSA
+SMIMEA = RdataType.SMIMEA
 HIP = RdataType.HIP
 NINFO = RdataType.NINFO
 CDS = RdataType.CDS
diff --git a/dns/rdtypes/ANY/SMIMEA.py b/dns/rdtypes/ANY/SMIMEA.py
new file mode 100644 (file)
index 0000000..3e50489
--- /dev/null
@@ -0,0 +1,7 @@
+import dns.rdatatype
+from dns.rdtypes.ANY.TLSA import TLSA
+
+
+@dns.immutable.immutable
+class SMIMEA(TLSA):
+    """SMIMEA record, same format as TLSA per https://tools.ietf.org/html/rfc8162#section-2"""
index 0d1a7406b97bff87ddd9c4c2f91f0af67b9caffe..b0ea7077a33d62a98d7d723603b9097c50a647c8 100644 (file)
@@ -48,6 +48,7 @@ __all__ = [
     'RP',
     'RRSIG',
     'RT',
+    'SMIMEA',
     'SOA',
     'SPF',
     'SSHFP',
index 347610e259f23c149f6ff65675492c2bba6de680..17a537a3759b4ef3b5eb880f9f20681f73cfc1e8 100644 (file)
@@ -433,6 +433,25 @@ Rdata Subclass Reference
 
       A ``dns.name.Name``, the exchange name.
       
+.. autoclass:: dns.rdtypes.ANY.SMIMEA.SMIMEA
+   :members:
+
+   .. attribute:: usage
+
+      An ``int``, the certificate usage.
+
+   .. attribute:: selector
+
+      An ``int``, the selector.
+
+   .. attribute:: mtype
+
+      An ``int``, the matching type.
+
+   .. attribute:: cert
+
+      A ``bytes``, the certificate association data.
+
 .. autoclass:: dns.rdtypes.ANY.SOA.SOA
    :members:
 
index df21370c48a9a07e262ce99456314889f6de0a86..ed526111c46cbcfc795df02a31734c317eb53583 100644 (file)
@@ -111,6 +111,8 @@ Rdatatypes
    :annotation: = 46
 .. py:data:: dns.rdatatype.RT
    :annotation: = 21
+.. py:data:: dns.rdatatype.SMIMEA
+   :annotation: = 53
 .. py:data:: dns.rdatatype.SIG
    :annotation: = 24
 .. py:data:: dns.rdatatype.SOA
index 257790c94c5dd8dfbd29555217693154c2a996c2..e5aed9505db19cd892afc013cca99140e1b945d9 100644 (file)
@@ -141,6 +141,8 @@ PTR
     `RFC 1035 <https://tools.ietf.org/html/rfc1035>`_
 RRSIG
     `RFC 4034 <https://tools.ietf.org/html/rfc4034>`_
+SMIMEA
+    `RFC 8162 <https://tools.ietf.org/html/rfc8162>`_
 SOA
     `RFC 1035 <https://tools.ietf.org/html/rfc1035>`_
 SPF
index b07724879b454a83abdeb987a04c977a5a9dc17e..c8c139537a82e40aab6a67d80b2545e683565f6c 100644 (file)
@@ -138,6 +138,9 @@ $TTL 3600   ; 1 hour
 tlsa1                  TLSA    3 1 1 a9cdf989b504fe5dca90c0d2167b6550570734f7c763e09fdf88904e06157065
 tlsa2                  TLSA    1 0 1 efddf0d915c7bdc5782c0881e1b2a95ad099fbdd06d7b1f77982d9364338d955
 tlsa3                  TLSA    1 0 2 81ee7f6c0ecc6b09b7785a9418f54432de630dd54dc6ee9e3c49de547708d236d4c413c3e97e44f969e635958aa410495844127c04883503e5b024cf7a8f6a94
+smimea1                        SMIMEA    3 1 1 a9cdf989b504fe5dca90c0d2167b6550570734f7c763e09fdf88904e06157065
+smimea2                        SMIMEA    1 0 1 efddf0d915c7bdc5782c0881e1b2a95ad099fbdd06d7b1f77982d9364338d955
+smimea3                        SMIMEA    1 0 2 81ee7f6c0ecc6b09b7785a9418f54432de630dd54dc6ee9e3c49de547708d236d4c413c3e97e44f969e635958aa410495844127c04883503e5b024cf7a8f6a94
 txt01                  TXT     "foo"
 txt02                  TXT     "foo" "bar"
 txt03                  TXT     foo
index 4aaea37787baaabcf346b8d6c58ddbc7fc76aef7..8c751c2c9a6d1d40161f570193c5b5b548c8d83e 100644 (file)
@@ -108,6 +108,9 @@ rt01 3600 IN RT 0 intermediate-host
 rt02 3600 IN RT 65535 .
 s 300 IN NS ns.s
 ns.s 300 IN A 73.80.65.49
+smimea1 3600 IN SMIMEA 3 1 1 a9cdf989b504fe5dca90c0d2167b6550570734f7c763e09fdf88904e06157065
+smimea2 3600 IN SMIMEA 1 0 1 efddf0d915c7bdc5782c0881e1b2a95ad099fbdd06d7b1f77982d9364338d955
+smimea3 3600 IN SMIMEA 1 0 2 81ee7f6c0ecc6b09b7785a9418f54432de630dd54dc6ee9e3c49de547708d236d4c413c3e97e44f969e635958aa410495844127c04883503e5b024cf7a8f6a94
 spf 3600 IN SPF "v=spf1 mx -all"
 srv01 3600 IN SRV 0 0 0 .
 srv02 3600 IN SRV 65535 65535 65535 old-slow-box.example.com.
index cd7a85556e43280cc4048c71121977a317a03cfc..ebe1a7ef7f1a23a08e20745b5201f22d078fe23f 100644 (file)
@@ -108,6 +108,9 @@ rt01.example. 3600 IN RT 0 intermediate-host.example.
 rt02.example. 3600 IN RT 65535 .
 s.example. 300 IN NS ns.s.example.
 ns.s.example. 300 IN A 73.80.65.49
+smimea1.example. 3600 IN SMIMEA 3 1 1 a9cdf989b504fe5dca90c0d2167b6550570734f7c763e09fdf88904e06157065
+smimea2.example. 3600 IN SMIMEA 1 0 1 efddf0d915c7bdc5782c0881e1b2a95ad099fbdd06d7b1f77982d9364338d955
+smimea3.example. 3600 IN SMIMEA 1 0 2 81ee7f6c0ecc6b09b7785a9418f54432de630dd54dc6ee9e3c49de547708d236d4c413c3e97e44f969e635958aa410495844127c04883503e5b024cf7a8f6a94
 spf.example. 3600 IN SPF "v=spf1 mx -all"
 srv01.example. 3600 IN SRV 0 0 0 .
 srv02.example. 3600 IN SRV 65535 65535 65535 old-slow-box.example.com.
index 4aaea37787baaabcf346b8d6c58ddbc7fc76aef7..8c751c2c9a6d1d40161f570193c5b5b548c8d83e 100644 (file)
@@ -108,6 +108,9 @@ rt01 3600 IN RT 0 intermediate-host
 rt02 3600 IN RT 65535 .
 s 300 IN NS ns.s
 ns.s 300 IN A 73.80.65.49
+smimea1 3600 IN SMIMEA 3 1 1 a9cdf989b504fe5dca90c0d2167b6550570734f7c763e09fdf88904e06157065
+smimea2 3600 IN SMIMEA 1 0 1 efddf0d915c7bdc5782c0881e1b2a95ad099fbdd06d7b1f77982d9364338d955
+smimea3 3600 IN SMIMEA 1 0 2 81ee7f6c0ecc6b09b7785a9418f54432de630dd54dc6ee9e3c49de547708d236d4c413c3e97e44f969e635958aa410495844127c04883503e5b024cf7a8f6a94
 spf 3600 IN SPF "v=spf1 mx -all"
 srv01 3600 IN SRV 0 0 0 .
 srv02 3600 IN SRV 65535 65535 65535 old-slow-box.example.com.
index 72ed15a1f8f4dab3ebe8b2fa8902ba9e5670b9c4..407140371fc7f1ff6cf38d6bbdf10f3de933be1f 100644 (file)
@@ -638,6 +638,18 @@ class RdataTestCase(unittest.TestCase):
         with self.assertRaises(dns.exception.SyntaxError):
             dns.rdata.from_text('in', 'txt', 'a' * 256)
 
+    def equal_smimea(self, a, b):
+        a = dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.SMIMEA, a)
+        b = dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.SMIMEA, b)
+        self.assertEqual(a, b)
+
+    def test_good_SMIMEA(self):
+        self.equal_smimea('3 0 1 aabbccddeeff', '3 0 01 AABBCCDDEEFF')
+
+    def test_bad_SMIMEA(self):
+        with self.assertRaises(dns.exception.SyntaxError):
+            dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.SMIMEA, '1 1 1 aGVsbG8gd29ybGQh')
+
 
 class UtilTestCase(unittest.TestCase):