internal NtlmAvPairSingleHostData(MsAvPairType type, uint z4, byte[] custom_data, byte[] machine_id) : base(type) { Z4 = z4; CustomData = custom_data; MachineId = machine_id; }
internal static bool TryParse(BinaryReader reader, out NtlmAvPair av_pair) { av_pair = null; if (reader.RemainingLength() < 4) { return(false); } MsAvPairType type = (MsAvPairType)reader.ReadInt16(); int length = reader.ReadUInt16(); if (reader.RemainingLength() < length) { return(false); } switch (type) { case MsAvPairType.DnsComputerName: case MsAvPairType.DnsDomainName: case MsAvPairType.DnsTreeName: case MsAvPairType.NbComputerName: case MsAvPairType.NbDomainName: case MsAvPairType.TargetName: if ((length % 1) != 0) { return(false); } av_pair = new NtlmAvPairString(type, Encoding.Unicode.GetString(reader.ReadBytes(length))); break; case MsAvPairType.Timestamp: if (length != 8) { return(false); } av_pair = new NtlmAvPairTimestamp(type, reader.ReadInt64()); break; case MsAvPairType.Flags: if (length != 4) { return(false); } av_pair = new NtlmAvPairFlags(type, reader.ReadInt32()); break; case MsAvPairType.SingleHost: if (length != 48) { return(false); } reader.ReadInt32(); uint z4 = reader.ReadUInt32(); byte[] custom_data = reader.ReadBytes(8); byte[] machine_id = reader.ReadBytes(32); av_pair = new NtlmAvPairSingleHostData(type, z4, custom_data, machine_id); break; default: av_pair = new NtlmAvPairBytes(type, reader.ReadBytes(length)); break; } return(true); }
internal NtlmAvPairFlags(MsAvPairType type, int value) : base(type) { Value = (MsvAvFlags)value; }
internal NtlmAvPairBytes(MsAvPairType type, byte[] value) : base(type) { Value = value; }
internal NtlmAvPairTimestamp(MsAvPairType type, long value) : base(type) { Value = DateTime.FromFileTime(value); }
internal NtlmAvPairString(MsAvPairType type, string value) : base(type) { Value = value; }
internal NtlmAvPair(MsAvPairType type) { Type = type; }