Home | History | Annotate | Line # | Download | only in ecdsa
      1 # Copyright (C) Internet Systems Consortium, Inc. ("ISC")
      2 #
      3 # SPDX-License-Identifier: MPL-2.0
      4 #
      5 # This Source Code Form is subject to the terms of the Mozilla Public
      6 # License, v. 2.0.  If a copy of the MPL was not distributed with this
      7 # file, you can obtain one at https://mozilla.org/MPL/2.0/.
      8 #
      9 # See the COPYRIGHT file distributed with this work for additional
     10 # information regarding copyright ownership.
     11 
     12 import os
     13 import pytest
     14 
     15 import dns.flags
     16 
     17 import isctest
     18 
     19 
     20 pytestmark = pytest.mark.extra_artifacts(
     21     [
     22         "ns*/trusted.conf",
     23         "ns1/K*",
     24         "ns1/dsset-*",
     25         "ns1/root.db",
     26         "ns1/root.db.signed",
     27         "ns1/signer.err",
     28     ]
     29 )
     30 
     31 
     32 def check_server_soa(resolver):
     33     msg = isctest.query.create(".", "SOA")
     34     res1 = isctest.query.tcp(msg, "10.53.0.1")
     35     res2 = isctest.query.tcp(msg, resolver)
     36     isctest.check.rrsets_equal(res1.answer, res2.answer)
     37     assert res2.flags & dns.flags.AD
     38 
     39 
     40 @pytest.mark.skipif(
     41     not os.getenv("ECDSAP256SHA256_SUPPORTED"),
     42     reason="algorithm ECDSA256 not supported",
     43 )
     44 def test_ecdsa256():
     45     check_server_soa("10.53.0.2")
     46 
     47 
     48 @pytest.mark.skipif(
     49     not os.getenv("ECDSAP384SHA384_SUPPORTED"),
     50     reason="algorithm ECDSA384 not supported",
     51 )
     52 def test_ecdsa384():
     53     check_server_soa("10.53.0.3")
     54