// Token: 0x06001C2E RID: 7214 RVA: 0x0006FA44 File Offset: 0x0006DC44 internal string EncodeCertChain(ChainContext chainContext, bool includeRootCert, X509Certificate2 signersCertificate) { uint count = (uint)chainContext.GetChains().Count; List <byte[]>[] array = new List <byte[]> [count]; uint[] array2 = new uint[count]; uint[] array3 = new uint[count]; uint num = 16U; int num2 = 0; foreach (CertificateChain certificateChain in chainContext.GetChains()) { array3[num2] = 16U; array2[num2] = 0U; array[num2] = new List <byte[]>(certificateChain.Elements.Count); foreach (ChainElement chainElement in certificateChain.Elements) { if (!signersCertificate.Equals(chainElement.Certificate) && (includeRootCert || (chainElement.TrustInformation & TrustInformation.IsSelfSigned) == TrustInformation.None)) { array3[num2] += 12U; byte[] rawData = chainElement.Certificate.RawData; array[num2].Add(rawData); array3[num2] += (uint)rawData.Length; array2[num2] += 1U; } } num += array3[num2]; num2++; } byte[] array4 = new byte[num]; int num3 = 0; num3 += ExBitConverter.Write(num, array4, num3); num3 += ExBitConverter.Write((uint)chainContext.Status, array4, num3); num3 += ExBitConverter.Write((uint)chainContext.TrustInformation, array4, num3); num3 += ExBitConverter.Write(count, array4, num3); num2 = 0; foreach (CertificateChain certificateChain2 in chainContext.GetChains()) { num3 += ExBitConverter.Write(array3[num2], array4, num3); num3 += ExBitConverter.Write((uint)certificateChain2.Status, array4, num3); num3 += ExBitConverter.Write((uint)certificateChain2.TrustInformation, array4, num3); num3 += ExBitConverter.Write(array2[num2], array4, num3); int num4 = 0; foreach (ChainElement chainElement2 in certificateChain2.Elements) { if (!signersCertificate.Equals(chainElement2.Certificate) && (includeRootCert || (chainElement2.TrustInformation & TrustInformation.IsSelfSigned) == TrustInformation.None)) { num3 += ExBitConverter.Write((uint)(array[num2][num4].Length + 12), array4, num3); num3 += ExBitConverter.Write((uint)chainElement2.Status, array4, num3); num3 += ExBitConverter.Write((uint)chainElement2.TrustInformation, array4, num3); Array.Copy(array[num2][num4], 0, array4, num3, array[num2][num4].Length); num3 += array[num2][num4].Length; num4++; } } num2++; } return(Convert.ToBase64String(array4)); }
internal byte[] GetBytes(Encoding encoding) { byte[] array; if (this.orgUnit == null) { array = new byte[6]; array[0] = 1; array[1] = 0; ExBitConverter.Write(0, array, 2); } else { if (this.configUnit.ObjectGuid == Guid.Empty || this.orgUnit.ObjectGuid == Guid.Empty) { throw new InvalidOperationException("OrganizationId is not fully populated and cannot be serialized"); } int byteCount = this.orgUnit.GetByteCount(encoding); int byteCount2 = this.configUnit.GetByteCount(encoding); array = new byte[byteCount + byteCount2 + 8 + 3]; int num = 0; array[num++] = 2; array[num++] = 1; num += ExBitConverter.Write(byteCount, array, num); array[num++] = 2; num += ExBitConverter.Write(byteCount2, array, num); this.orgUnit.GetBytes(encoding, array, num); num += byteCount; this.configUnit.GetBytes(encoding, array, num); } return(array); }
private void WriteHeader(EntryId.EntryIdFlags flags, byte[] buffer) { int num = 0; num += ExBitConverter.Write((int)flags, buffer, num); num += ExBitConverter.Write(this.providerGuid, buffer, num); num += ExBitConverter.Write(1, buffer, num); num += ExBitConverter.Write((int)this.displayType, buffer, num); }
public static void Serialize(StreamPropertyType propId, object value, byte[] buffer, ref int offset) { if (buffer == null || offset > buffer.Length) { throw new ArgumentException("buffer"); } offset += ExBitConverter.Write((short)propId, buffer, offset); PropertyStreamWriter.WriteValue(propId, value, buffer, ref offset); }
internal static void SetDword(byte[] buff, ref int pos, uint dw) { if (buff != null) { AddressBookEntryId.BinaryHelper.CheckBounds(pos, buff.Length, AddressBookEntryId.BinaryHelper.DWordSize); ExBitConverter.Write(dw, buff, pos); } pos += AddressBookEntryId.BinaryHelper.DWordSize; }
// Token: 0x06000B93 RID: 2963 RVA: 0x00033628 File Offset: 0x00031828 private void SendPageNumbersToSource(object dummy) { Exception ex = null; IOBuffer iobuffer = null; int num = this.m_pageList.Length; try { this.GetChannel(); SeedPageReaderMultiplePageRequest seedPageReaderMultiplePageRequest = new SeedPageReaderMultiplePageRequest(this.m_channel, this.m_databaseGuid, this.m_databaseName, this.m_databasePath, (long)this.m_pageList.Length); seedPageReaderMultiplePageRequest.Send(); iobuffer = IOBufferPool.Allocate(); iobuffer.AppendOffset = 0; foreach (long num2 in this.m_pageList) { if (iobuffer.RemainingSpace >= 4) { DiagCore.RetailAssert(num2 <= 2147483647L, "ese uses 31bit page numbers but {0} was passed", new object[] { num2 }); ExBitConverter.Write((uint)num2, iobuffer.Buffer, iobuffer.AppendOffset); iobuffer.AppendOffset += 4; } else { this.m_channel.Write(iobuffer.Buffer, 0, iobuffer.AppendOffset); iobuffer.AppendOffset = 0; } } if (iobuffer.AppendOffset > 0) { this.m_channel.Write(iobuffer.Buffer, 0, iobuffer.AppendOffset); } } catch (NetworkRemoteException ex2) { ex = ex2; } catch (NetworkTransportException ex3) { ex = ex3; } finally { this.m_pageList = null; if (iobuffer != null) { IOBufferPool.Free(iobuffer); } } if (ex != null) { ReplayCrimsonEvents.SendPageNumbersToSourceFailed.Log <Guid, string, int, Exception>(this.m_databaseGuid, this.DatabaseName, num, ex); } }
private void AppendProperty(OofHistory.PropId propId, byte[] propertyValue) { this.data[this.dataPosition++] = (byte)propId; ushort num = (ushort)propertyValue.Length; ExBitConverter.Write(num, this.data, this.dataPosition); this.dataPosition += 2; Buffer.BlockCopy(propertyValue, 0, this.data, this.dataPosition, (int)num); this.dataPosition += (int)num; }
private static void WriteMultiValuedProperty <T>(StreamPropertyType propId, MultiValuedProperty <T> list, byte[] buffer, ref int offset) { int num = (list != null) ? list.Count : 0; offset += ExBitConverter.Write(num, buffer, offset); for (int i = 0; i < num; i++) { PropertyStreamWriter.WriteValue(propId & ~StreamPropertyType.MultiValuedProperty, list[i], buffer, ref offset); } }
private static void WriteArray <T>(StreamPropertyType propId, T[] array, byte[] buffer, ref int offset) { int num = (array != null) ? array.Length : 0; offset += ExBitConverter.Write(num, buffer, offset); for (int i = 0; i < num; i++) { PropertyStreamWriter.WriteValue(propId & ~StreamPropertyType.Array, array[i], buffer, ref offset); } }
public byte[] GetBytes() { byte[] array = new byte[16]; long value = IPAddress.HostToNetworkOrder((long)this.highBytes); ExBitConverter.Write(value, array, 0); value = IPAddress.HostToNetworkOrder((long)this.lowBytes); ExBitConverter.Write(value, array, 8); return(array); }
public byte[] ToBytes() { byte[] array = new byte[this.mailbox.Length + this.messageId.Length + 10]; int num = 0; num += ExBitConverter.Write(this.sentTime, array, num); num += ExBitConverter.Write(this.messageId, false, array, num); num += ExBitConverter.Write(this.mailbox, false, array, num); return(array); }
protected void WriteCoconetBlock(byte[] buf, int offset, int length) { byte[] compressBuf = this.CompressBuf; int num; this.m_coconetCompressor.Compress(buf, offset, length, compressBuf, 9, 1048577, out num); compressBuf[0] = 4; ExBitConverter.Write(num, compressBuf, 1); ExBitConverter.Write(length, compressBuf, 5); this.m_tcpChannel.Write(compressBuf, 0, 9 + num); }
public static byte[] ToBytesFromRegistryFormat(REG_TIMEZONE_INFO timeZoneInfo) { byte[] array = new byte[O11TimeZoneFormatter.OUTLOOK_TIMEZONE_INFO.Size]; ExBitConverter.Write(timeZoneInfo.Bias, array, O11TimeZoneFormatter.OUTLOOK_TIMEZONE_INFO.BiasOffset); ExBitConverter.Write(timeZoneInfo.StandardBias, array, O11TimeZoneFormatter.OUTLOOK_TIMEZONE_INFO.StandardBiasOffset); ExBitConverter.Write(timeZoneInfo.DaylightBias, array, O11TimeZoneFormatter.OUTLOOK_TIMEZONE_INFO.DaylightBiasOffset); ExBitConverter.Write(0, array, O11TimeZoneFormatter.OUTLOOK_TIMEZONE_INFO.StandardYearOffset); timeZoneInfo.StandardDate.Write(new ArraySegment <byte>(array, O11TimeZoneFormatter.OUTLOOK_TIMEZONE_INFO.StandardDateOffset, NativeMethods.SystemTime.Size)); ExBitConverter.Write(0, array, O11TimeZoneFormatter.OUTLOOK_TIMEZONE_INFO.DaylightYearOffset); timeZoneInfo.DaylightDate.Write(new ArraySegment <byte>(array, O11TimeZoneFormatter.OUTLOOK_TIMEZONE_INFO.DaylightDateOffset, NativeMethods.SystemTime.Size)); return(array); }
public InboxRuleIdParameter(string inboxRuleId) { if (string.IsNullOrEmpty(inboxRuleId)) { throw new ArgumentNullException("inboxRuleId"); } this.rawInput = inboxRuleId; int num = inboxRuleId.Length; int num2; do { num2 = num; num = inboxRuleId.LastIndexOf("\\\\", num2 - 1, num2); }while (num != -1); int num3 = inboxRuleId.LastIndexOf('\\', num2 - 1, num2); if (num3 == 0 || num3 == inboxRuleId.Length - 1) { throw new ArgumentException(Strings.ErrorInvalidParameterFormat("inboxRuleId"), "inboxRuleId"); } string text; string text2; if (num3 > 0) { text = inboxRuleId.Substring(0, num3); text2 = inboxRuleId.Substring(1 + num3); } else { text2 = inboxRuleId; text = null; } if (num2 != inboxRuleId.Length) { text2 = text2.Replace("\\\\", '\\'.ToString()); } if (!string.IsNullOrEmpty(text)) { this.rawMailbox = new MailboxIdParameter(text); } ulong value; if (ulong.TryParse(text2, out value)) { byte[] array = new byte[8]; ExBitConverter.Write((long)value, array, 0); this.rawRuleId = RuleId.Deserialize(array, 0); return; } this.rawRuleName = text2; }
// Token: 0x06000C85 RID: 3205 RVA: 0x00027650 File Offset: 0x00025850 public override byte[] GetBytes() { byte[] bytes = base.MailboxOwnerId.GetBytes(); byte[] array = new byte[16 + bytes.Length + 2]; ExBitConverter.Write((short)bytes.Length, array, 0); int num = 2; Array.Copy(bytes, 0, array, num, bytes.Length); num += bytes.Length; ExBitConverter.Write(this.RuleIdGuid, array, num); return(array); }
public string ToBase64String() { int num = 29; byte[] array = new byte[num]; int num2 = 0; num2 += ExBitConverter.Write(1, array, num2); num2 += ExBitConverter.Write(this.mdbGuid, array, num2); num2 += ExBitConverter.Write(this.mapiWatermark, array, num2); array[num2++] = (this.wasEventProcessed ? 1 : 0); return(Convert.ToBase64String(array)); }
// Token: 0x0600043B RID: 1083 RVA: 0x000180C8 File Offset: 0x000162C8 internal byte[] GetBytes() { int byteCount = this.GetByteCount(); byte[] array = new byte[byteCount]; int num = 0; int bytes = Encoding.Unicode.GetBytes(this.stringValue, 0, this.stringValue.Length, array, 4); num += ExBitConverter.Write(bytes, array, num); num += bytes; this.objectIdValue.GetBytes(Encoding.Unicode, array, num); return(array); }
public int ToBytes(ArraySegment <byte> target) { if (target.Count < O12TimeZoneFormatter.ExchangeTimeZoneRule.Size) { throw new ArgumentOutOfRangeException(); } ExBitConverter.Write((short)this.MajorVersion, target.Array, target.Offset + O12TimeZoneFormatter.ExchangeTimeZoneRule.MajorVersionOffset); ExBitConverter.Write((short)this.MinVersion, target.Array, target.Offset + O12TimeZoneFormatter.ExchangeTimeZoneRule.MinVersionOffset); ExBitConverter.Write(this.ruleSize, target.Array, target.Offset + O12TimeZoneFormatter.ExchangeTimeZoneRule.RuleSizeOffset); ExBitConverter.Write(this.Flags, target.Array, target.Offset + O12TimeZoneFormatter.ExchangeTimeZoneRule.FlagsOffset); this.Start.Write(new ArraySegment <byte>(target.Array, target.Offset + O12TimeZoneFormatter.ExchangeTimeZoneRule.StartOffset, NativeMethods.SystemTime.Size)); this.RegTimeZoneInfo.Write(new ArraySegment <byte>(target.Array, target.Offset + O12TimeZoneFormatter.ExchangeTimeZoneRule.RegTimeZoneInfoOffset, REG_TIMEZONE_INFO.Size)); return(O12TimeZoneFormatter.ExchangeTimeZoneRule.Size); }
public override byte[] GetBytes() { byte[] array = new byte[16]; ExBitConverter.Write(this.extensionGuid, array, 0); byte[] bytes = base.MailboxOwnerId.GetBytes(); byte[] array2 = new byte[array.Length + bytes.Length + 2]; ExBitConverter.Write((short)bytes.Length, array2, 0); int num = 2; Array.Copy(bytes, 0, array2, num, bytes.Length); num += bytes.Length; Array.Copy(array, 0, array2, num, array.Length); return(array2); }
private static void SetCadataTtlCookie(AesCryptoServiceProvider aes, int flags, HttpRequest httpRequest, HttpResponse httpResponse) { using (ICryptoTransform cryptoTransform = aes.CreateEncryptor()) { FbaModule.DetermineKeyIntervalsIfNecessary(); bool flag = (flags & 4) == 4; bool flag2 = FbaModule.IsMowa(httpRequest, flag); ExDateTime exDateTime = ExDateTime.UtcNow.AddTicks(flag2 ? FbaModule.fbaMowaKeyTTL.Ticks : (flag ? FbaModule.fbaPrivateKeyTTL.Ticks : FbaModule.fbaPublicKeyTTL.Ticks)); byte[] array = new byte[9]; ExBitConverter.Write(exDateTime.UtcTicks, array, 0); array[8] = (byte)flags; byte[] inArray = cryptoTransform.TransformFinalBlock(array, 0, array.Length); FbaModule.CreateAndAddCookieToResponse(httpRequest, httpResponse, "cadataTTL", Convert.ToBase64String(inArray)); } }
public static void ExpandIdSet(IdSet idset, Action <byte[]> action) { foreach (GuidGlobCountSet guidGlobCountSet in idset) { foreach (GlobCountRange globCountRange in guidGlobCountSet.GlobCountSet) { for (ulong num = globCountRange.LowBound; num <= globCountRange.HighBound; num += 1UL) { byte[] array = new byte[22]; int dstOffset = ExBitConverter.Write(guidGlobCountSet.Guid, array, 0); Buffer.BlockCopy(IdConverter.GlobcntIntoByteArray(num), 0, array, dstOffset, 6); action(array); } } } }
public static string GetDiagnosticContextFromThread() { if (!DiagnosticContext.HasData) { return(string.Empty); } byte[] array = DiagnosticContext.PackInfo(); byte[] array2 = new byte[array.Length + 6]; int num = 0; ExBitConverter.Write(0, array2, num); num += 2; ExBitConverter.Write((uint)array.Length, array2, num); num += 4; Array.Copy(array, 0, array2, num, array.Length); return(string.Format("[diag::{0}]", Convert.ToBase64String(array2))); }
public int ToBytes(ArraySegment <byte> target) { int size = this.GetSize(); if (target.Count < size) { throw new ArgumentOutOfRangeException(); } ExBitConverter.Write((short)this.MajorVersion, target.Array, target.Offset + O12TimeZoneFormatter.ExchangeTimeZoneHeader.MajorVersionOffset); ExBitConverter.Write((short)this.MinVersion, target.Array, target.Offset + O12TimeZoneFormatter.ExchangeTimeZoneHeader.MinVersionOffset); ExBitConverter.Write(this.headerSize, target.Array, target.Offset + O12TimeZoneFormatter.ExchangeTimeZoneHeader.HeaderSizeOffset); ExBitConverter.Write(this.flags, target.Array, target.Offset + O12TimeZoneFormatter.ExchangeTimeZoneHeader.FlagsOffset); ExBitConverter.Write(this.KeyNameLength, target.Array, target.Offset + O12TimeZoneFormatter.ExchangeTimeZoneHeader.KeyNameLengthOffset); ExBitConverter.Write(this.KeyName, true, target.Array, target.Offset + O12TimeZoneFormatter.ExchangeTimeZoneHeader.KeyNameOffset); ExBitConverter.Write(this.RuleCount, target.Array, target.Offset + O12TimeZoneFormatter.ExchangeTimeZoneHeader.KeyNameOffset + (int)(this.KeyNameLength * 2)); return(size); }
public static void WriteAttachmentIds(IList <AttachmentId> attachmentIds, byte[] idBytes, int index) { if (attachmentIds != null) { if (attachmentIds.Count > 255) { throw new InvalidIdTooManyAttachmentLevelsException(); } idBytes[index++] = (byte)attachmentIds.Count; for (int i = 0; i < attachmentIds.Count; i++) { byte[] array = attachmentIds[i].ToByteArray(); index += ExBitConverter.Write((short)array.Length, idBytes, index); Array.Copy(array, 0, idBytes, index, array.Length); index += array.Length; } } }
private static int RemoveEntriesWithProperty(int historyLength, byte[] buffer, OofHistory.PropId propId, byte[] propValue, long hashCode) { int num = 6; int currentEntryStart = 6; int result = 6; uint num2 = BitConverter.ToUInt32(buffer, 2); if (10000U < num2) { num2 = 10000U; } uint num3 = num2; for (uint num4 = 0U; num4 < num2; num4 += 1U) { if (num >= historyLength) { OofHistory.HandleInsufficientDataCorruption(hashCode, "Unable to get property count of entry " + num4); return(result); } byte propertyCount = buffer[num++]; bool flag; if (OofHistory.MatchAnyPropertiesInEntry(buffer, propId, propValue, propertyCount, historyLength, num4, hashCode, ref num, out flag)) { num3 -= 1U; } else { if (flag) { return(result); } OofHistory.HandleNonMatchingProperty(buffer, num, currentEntryStart, ref result); } currentEntryStart = num; } if (num3 < num2) { ExBitConverter.Write(num3, buffer, 2); } return(result); }
public void AppendEntry(int entryCount, byte[] senderAddress, byte[] globalRuleId) { if (this.data != null) { throw new InvalidOperationException("OOF history writer only supports one append operation."); } this.oofHistoryStream.Position = this.oofHistoryStream.Length; int num = 7 + senderAddress.Length + globalRuleId.Length; this.data = new byte[num]; this.data[0] = 2; this.dataPosition = 1; this.AppendProperty(OofHistory.PropId.SenderAddress, senderAddress); this.AppendProperty(OofHistory.PropId.GlobalRuleId, globalRuleId); this.oofHistoryStream.Write(this.data, 0, this.dataPosition); this.oofHistoryStream.Seek(2L, SeekOrigin.Begin); ExBitConverter.Write(entryCount, this.data, 0); this.oofHistoryStream.Write(this.data, 0, 4); this.oofHistoryStream.Flush(); }
public byte[] ToByteArray() { short num = 0; if (this.attachKey != null) { num = (short)this.attachKey.Length; } int num2 = (int)(2 + num); byte[] array = new byte[num2]; int num3 = 0; num3 += ExBitConverter.Write(num, array, num3); if (this.attachKey != null) { this.attachKey.CopyTo(array, num3); } return(array); }
internal byte[] ToByteArray() { if (this.bytes == null) { if (this.IsEphemeral) { int num = 32; this.bytes = new byte[num]; this.WriteHeader(EntryId.EntryIdFlags.Ephemeral, this.bytes); ExBitConverter.Write(this.ephemeralId, this.bytes, 28); } else { byte[] array = Encoding.ASCII.GetBytes(this.dn); int num2 = 28 + array.Length + 1; this.bytes = new byte[num2]; this.WriteHeader(EntryId.EntryIdFlags.Permanent, this.bytes); Array.Copy(array, 0, this.bytes, 28, array.Length); } } return(this.bytes); }
internal void Append(Guid g) { this.MakeSpaceToAppend(16); ExBitConverter.Write(g, this.m_buf, this.m_position); this.m_position += 16; }
internal void Append(ushort val) { this.MakeSpaceToAppend(2); ExBitConverter.Write(val, this.m_buf, this.m_position); this.m_position += 2; }