internal static bool TryReadParameters(DataSegment data, out DnsSecNSec3HashAlgorithm hashAlgorithm, out DnsSecNSec3Flags flags, out ushort iterations, out DataSegment salt)
        {
            if (data.Length < ConstantPartLength)
            {
                hashAlgorithm = DnsSecNSec3HashAlgorithm.Sha1;
                flags         = DnsSecNSec3Flags.None;
                iterations    = 0;
                salt          = null;
                return(false);
            }

            hashAlgorithm = (DnsSecNSec3HashAlgorithm)data[Offset.HashAlgorithm];
            flags         = (DnsSecNSec3Flags)data[Offset.Flags];
            iterations    = data.ReadUShort(Offset.Iterations, Endianity.Big);

            int saltLength = data[Offset.SaltLength];

            if (data.Length - Offset.Salt < saltLength)
            {
                salt = null;
                return(false);
            }
            salt = data.Subsegment(Offset.Salt, saltLength);
            return(true);
        }
        internal DnsResourceDataNextDomainSecure3Base(DnsSecNSec3HashAlgorithm hashAlgorithm, DnsSecNSec3Flags flags, ushort iterations, DataSegment salt)
        {
            if (salt.Length > byte.MaxValue)
                throw new ArgumentOutOfRangeException("salt", salt.Length, string.Format(CultureInfo.InvariantCulture, "Cannot bigger than {0}.", byte.MaxValue));

            HashAlgorithm = hashAlgorithm;
            Flags = flags;
            Iterations = iterations;
            Salt = salt;
        }
        internal DnsResourceDataNextDomainSecure3Base(DnsSecNSec3HashAlgorithm hashAlgorithm, DnsSecNSec3Flags flags, ushort iterations, DataSegment salt)
        {
            if (salt.Length > byte.MaxValue)
            {
                throw new ArgumentOutOfRangeException("salt", salt.Length, string.Format(CultureInfo.InvariantCulture, "Cannot bigger than {0}.", byte.MaxValue));
            }

            HashAlgorithm = hashAlgorithm;
            Flags         = flags;
            Iterations    = iterations;
            Salt          = salt;
        }
示例#4
0
 private DnsResourceDataNextDomainSecure3(DnsSecNSec3HashAlgorithm hashAlgorithm, DnsSecNSec3Flags flags, ushort iterations, DataSegment salt, DataSegment nextHashedOwnerName, DnsTypeBitmaps typeBitmaps)
     : base(hashAlgorithm, flags, iterations, salt)
 {
     if (nextHashedOwnerName.Length > (int)byte.MaxValue)
     {
         throw new ArgumentOutOfRangeException("nextHashedOwnerName", (object)nextHashedOwnerName.Length, string.Format((IFormatProvider)CultureInfo.InvariantCulture, "Cannot bigger than {0}.", new object[1]
         {
             (object)byte.MaxValue
         }));
     }
     this.NextHashedOwnerName = nextHashedOwnerName;
     this._typeBitmaps        = typeBitmaps;
 }
 internal DnsResourceDataNextDomainSecure3Base(DnsSecNSec3HashAlgorithm hashAlgorithm, DnsSecNSec3Flags flags, ushort iterations, DataSegment salt)
 {
     if (salt.Length > (int)byte.MaxValue)
     {
         throw new ArgumentOutOfRangeException("salt", (object)salt.Length, string.Format((IFormatProvider)CultureInfo.InvariantCulture, "Cannot bigger than {0}.", new object[1]
         {
             (object)byte.MaxValue
         }));
     }
     this.HashAlgorithm = hashAlgorithm;
     this.Flags         = flags;
     this.Iterations    = iterations;
     this.Salt          = salt;
 }
        internal static bool TryReadParameters(DataSegment data, out DnsSecNSec3HashAlgorithm hashAlgorithm, out DnsSecNSec3Flags flags, out ushort iterations, out DataSegment salt)
        {
            if (data.Length < 5)
            {
                hashAlgorithm = DnsSecNSec3HashAlgorithm.Sha1;
                flags         = DnsSecNSec3Flags.None;
                iterations    = (ushort)0;
                salt          = (DataSegment)null;
                return(false);
            }
            hashAlgorithm = (DnsSecNSec3HashAlgorithm)data[0];
            flags         = (DnsSecNSec3Flags)data[1];
            iterations    = data.ReadUShort(2, Endianity.Big);
            int length = (int)data[4];

            if (data.Length - 5 < length)
            {
                salt = (DataSegment)null;
                return(false);
            }
            salt = data.Subsegment(5, length);
            return(true);
        }
 public DnsResourceDataNextDomainSecure3Parameters(DnsSecNSec3HashAlgorithm hashAlgorithm, DnsSecNSec3Flags flags, ushort iterations, DataSegment salt)
     : base(hashAlgorithm, flags, iterations, salt)
 {
 }
        internal static bool TryReadParameters(DataSegment data, out DnsSecNSec3HashAlgorithm hashAlgorithm, out DnsSecNSec3Flags flags, out ushort iterations, out DataSegment salt)
        {
            if (data.Length < ConstantPartLength)
            {
                hashAlgorithm = DnsSecNSec3HashAlgorithm.Sha1;
                flags = DnsSecNSec3Flags.None;
                iterations = 0;
                salt = null;
                return false;
            }

            hashAlgorithm = (DnsSecNSec3HashAlgorithm)data[Offset.HashAlgorithm];
            flags = (DnsSecNSec3Flags)data[Offset.Flags];
            iterations = data.ReadUShort(Offset.Iterations, Endianity.Big);
            
            int saltLength = data[Offset.SaltLength];
            if (data.Length - Offset.Salt < saltLength)
            {
                salt = null;
                return false;
            }
            salt = data.Subsegment(Offset.Salt, saltLength);
            return true;
        }
示例#9
0
 public DnsResourceDataNextDomainSecure3(DnsSecNSec3HashAlgorithm hashAlgorithm, DnsSecNSec3Flags flags, ushort iterations, DataSegment salt, DataSegment nextHashedOwnerName, IEnumerable <DnsType> typesExist)
     : this(hashAlgorithm, flags, iterations, salt, nextHashedOwnerName, new DnsTypeBitmaps(typesExist))
 {
 }