Example #1
0
        public void Create()
        {
            var option = EdnsDHUOption.Create();

            Assert.AreEqual(EdnsOptionType.DHU, option.Type);
            CollectionAssert.AreEqual(DigestRegistry.Digests.Keys, option.Algorithms);
        }
Example #2
0
        /// <summary>
        ///   Create a new instance of the <see cref="EdnsDHUOption"/> class with
        ///   the known/implemented hashing algorithms.
        /// </summary>
        /// <remarks>
        ///   The <see cref="Algorithms"/> are obtained from the <see cref="DigestRegistry"/>.
        /// </remarks>
        public static EdnsDHUOption Create()
        {
            var option = new EdnsDHUOption();

            option.Algorithms.AddRange(DigestRegistry.Digests.Keys);
            return(option);
        }
Example #3
0
        public void Roundtrip()
        {
            var opt1     = new OPTRecord();
            var expected = new EdnsDHUOption
            {
                Algorithms = { DigestType.GostR34_11_94, DigestType.Sha512 }
            };

            Assert.AreEqual(EdnsOptionType.DHU, expected.Type);
            opt1.Options.Add(expected);

            var opt2   = (OPTRecord) new ResourceRecord().Read(opt1.ToByteArray());
            var actual = (EdnsDHUOption)opt2.Options[0];

            Assert.AreEqual(expected.Type, actual.Type);
            CollectionAssert.AreEqual(expected.Algorithms, actual.Algorithms);
        }