示例#1
0
        public void WriteDnsType()
        {
            var text   = new StringWriter();
            var writer = new PresentationWriter(text);

            writer.WriteDnsType(DnsType.ANY);
            writer.WriteDnsType((DnsType)1234, appendSpace: false);
            Assert.AreEqual("ANY TYPE1234", text.ToString());
        }
示例#2
0
        /// <inheritdoc />
        public override void WriteData(PresentationWriter writer)
        {
            writer.WriteByte((byte)HashAlgorithm);
            writer.WriteByte((byte)Flags);
            writer.WriteUInt16(Iterations);

            if (Salt == null || Salt.Length == 0)
            {
                writer.WriteString("-");
            }
            else
            {
                writer.WriteBase16String(Salt);
            }

            writer.WriteString(Base32.ExtendedHex.Encode(NextHashedOwnerName, padding: false).ToLowerInvariant());

            bool next = false;

            foreach (var type in Types)
            {
                if (next)
                {
                    writer.WriteSpace();
                }
                writer.WriteDnsType(type, appendSpace: false);
                next = true;
            }
        }
示例#3
0
 /// <inheritdoc />
 public override string ToString()
 {
     using (var s = new StringWriter())
     {
         var writer = new PresentationWriter(s);
         writer.WriteDomainName(Name);
         writer.WriteDnsClass(Class);
         writer.WriteDnsType(Type, appendSpace: false);
         return(s.ToString());
     }
 }
示例#4
0
 /// <inheritdoc />
 public override void WriteData(PresentationWriter writer)
 {
     writer.WriteDnsType(TypeCovered);
     writer.WriteByte((byte)Algorithm);
     writer.WriteByte(Labels);
     writer.WriteTimeSpan32(OriginalTTL);
     writer.WriteDateTime(SignatureExpiration);
     writer.WriteDateTime(SignatureInception);
     writer.WriteUInt16(KeyTag);
     writer.WriteDomainName(SignerName);
     writer.WriteBase64String(Signature, appendSpace: false);
 }
示例#5
0
        /// <inheritdoc />
        public void Write(PresentationWriter writer)
        {
            writer.WriteDomainName(Name);
            if (TTL != DefaultTTL)
            {
                writer.WriteTimeSpan32(TTL);
            }
            writer.WriteDnsClass(Class);
            writer.WriteDnsType(Type);

            WriteData(writer);
            writer.WriteEndOfLine();
        }
示例#6
0
        /// <inheritdoc />
        public override void WriteData(PresentationWriter writer)
        {
            writer.WriteDomainName(NextOwnerName);

            bool next = false;

            foreach (var type in Types)
            {
                if (next)
                {
                    writer.WriteSpace();
                }
                writer.WriteDnsType(type, appendSpace: false);
                next = true;
            }
        }