示例#1
0
        internal override DnsResourceData CreateInstance(DataSegment data)
        {
            DnsSecNSec3HashAlgorithm hashAlgorithm;
            DnsSecNSec3Flags         flags;
            ushort      iterations;
            DataSegment salt;

            if (!DnsResourceDataNextDomainSecure3Base.TryReadParameters(data, out hashAlgorithm, out flags, out iterations, out salt))
            {
                return((DnsResourceData)null);
            }
            int parametersLength = DnsResourceDataNextDomainSecure3Base.GetParametersLength(salt.Length);

            if (data.Length - parametersLength < 1)
            {
                return((DnsResourceData)null);
            }
            int offset = parametersLength + 1;
            int length = (int)data[parametersLength];

            if (data.Length - offset < length)
            {
                return((DnsResourceData)null);
            }
            DataSegment    nextHashedOwnerName = data.Subsegment(offset, length);
            int            num      = offset + length;
            DnsTypeBitmaps instance = DnsTypeBitmaps.CreateInstance(data.Buffer, data.StartOffset + num, data.Length - num);

            if (instance == null)
            {
                return((DnsResourceData)null);
            }
            return((DnsResourceData) new DnsResourceDataNextDomainSecure3(hashAlgorithm, flags, iterations, salt, nextHashedOwnerName, instance));
        }
        internal override DnsResourceData CreateInstance(DataSegment data)
        {
            DnsSecNSec3HashAlgorithm hashAlgorithm;
            DnsSecNSec3Flags         flags;
            ushort      iterations;
            DataSegment salt;

            if (!DnsResourceDataNextDomainSecure3Base.TryReadParameters(data, out hashAlgorithm, out flags, out iterations, out salt))
            {
                return((DnsResourceData)null);
            }
            if (data.Length != DnsResourceDataNextDomainSecure3Base.GetParametersLength(salt.Length))
            {
                return((DnsResourceData)null);
            }
            return((DnsResourceData) new DnsResourceDataNextDomainSecure3Parameters(hashAlgorithm, flags, iterations, salt));
        }