public override void ReadBody(NdrBinaryStream stream) { ClaimSource = (ClaimSourceType)stream.ReadInt(); Count = stream.ReadUnsignedInt(); var claims = new List <ClaimEntry>(); stream.Seek(4); var count = stream.ReadInt(); if (Count != count) { throw new InvalidDataException($"Claims count {Count} doesn't match actual count {count}"); } for (var i = 0; i < Count; i++) { var claim = new ClaimEntry(); claim.ReadBody(stream); claims.Add(claim); } foreach (var entry in claims) { entry.ReadValue(stream); } ClaimEntries = claims; }
public override void ReadBody(NdrBinaryStream stream) { stream.Seek(4); // offset for Id Type = (ClaimType)stream.ReadShort(); stream.Align(4); Count = stream.ReadUnsignedInt(); stream.Seek(4); // offset to values }
public override void ReadBody(NdrBinaryStream stream) { Type = (ChecksumType)stream.ReadUnsignedInt(); SignaturePosition = (int)stream.Position; Signature = SetSignatureValue(Type, size => stream.Read(size)); Validator = CryptoService.CreateChecksumValidator(Type, Signature, signatureData); if (stream.Position < stream.Length) { RODCIdentifier = stream.ReadShort(); } }
private static SecurityIdentifier[] ParseExtraSids(NdrBinaryStream Stream, int extraSidCount, int extraSidPointer) { if (extraSidPointer == 0) { return(new SecurityIdentifier[0]); } int realExtraSidCount = Stream.ReadInt(); if (realExtraSidCount != extraSidCount) { throw new InvalidDataException($"Expected Sid count {extraSidCount} doesn't match actual sid count {realExtraSidCount}"); } var extraSidAtts = new SecurityIdentifier[extraSidCount]; var pointers = new int[extraSidCount]; var attributes = new SidAttributes[extraSidCount]; for (int i = 0; i < extraSidCount; i++) { pointers[i] = Stream.ReadInt(); attributes[i] = (SidAttributes)Stream.ReadUnsignedInt(); } for (int i = 0; i < extraSidCount; i++) { SecurityIdentifier sid = null; if (pointers[i] != 0) { sid = new SecurityIdentifier(Stream.ReadSid(), attributes[i]); } extraSidAtts[i] = sid; } return(extraSidAtts); }