public static NtlmTargetInfoList Parse(byte[] tagetInfo, Encoding encoding)
        {
            var result = new NtlmTargetInfoList();

            result.Fill(tagetInfo, encoding);
            return(result);
        }
        public NtlmChallengeMessage(ChallengeMessageStruct message, string targetName,
                                    params NtlmTargetInfo[] targetInfos)
        {
            Message    = message;
            TargetName = targetName;

            if (targetInfos != null)
            {
                TargetInfoList = new NtlmTargetInfoList(targetInfos);
            }

            Rectify();
        }
        public virtual void Fill(byte[] data)
        {
            if (data == null)
            {
                throw new ArgumentNullException(nameof(data));
            }
            if (data.Length == 0)
            {
                throw new ArgumentException($"{nameof(data)} array is empty.");
            }

            Message = data.ToStruct <ChallengeMessageStruct>();

            if (Message.TargetNameLength > 0)
            {
                var targetNameBytes = data.NewCopy(Message.TargetNameOffset, Message.TargetNameLength);
                TargetName = GetEncoding().GetString(targetNameBytes);
            }
            if (Message.TargetNameLength > 0)
            {
                var targetInfosBytes = data.NewCopy(Message.TargetInfosOffset, Message.TargetInfosLength);
                TargetInfoList = NtlmTargetInfoList.Parse(targetInfosBytes, GetEncoding());
            }
        }