public ClaimsSetMetadata(byte[] data) { var pacStream = new NdrBinaryReader(data); Header = new RpcHeader(pacStream); ClaimSetSize = pacStream.ReadInt(); pacStream.Seek(4); CompressionFormat = (CompressionFormat)pacStream.ReadInt(); UncompressedClaimSetSize = pacStream.ReadInt(); ReservedType = pacStream.ReadShort(); ReservedFieldSize = pacStream.ReadInt(); pacStream.Align(8); var size = pacStream.ReadInt(); if (size != ClaimSetSize) { throw new InvalidDataException($"Data length {size} doesn't match expected ClaimSetSize {ClaimSetSize}"); } var claimSet = pacStream.Read(ClaimSetSize); if (CompressionFormat != CompressionFormat.COMPRESSION_FORMAT_NONE) { claimSet = Compressions.Decompress(claimSet, UncompressedClaimSetSize, CompressionFormat); } ClaimsSet = new ClaimsSet(claimSet); ReservedField = pacStream.Read(ReservedFieldSize); }
public UpnDomainInfo(byte[] data) { var pacStream = new NdrBinaryReader(data); UpnLength = pacStream.ReadShort(); UpnOffset = pacStream.ReadShort(); DnsDomainNameLength = pacStream.ReadShort(); DnsDomainNameOffset = pacStream.ReadShort(); Flags = (UpnDomainFlags)pacStream.ReadInt(); pacStream.Align(8); Upn = Encoding.Unicode.GetString(pacStream.Read(UpnLength)); pacStream.Align(8); Domain = Encoding.Unicode.GetString(pacStream.Read(DnsDomainNameLength)); }