Ejemplo n.º 1
0
        public static byte[] ComputeHash(byte[] userContextIdBinary, byte[] timestampBinary, string logOnUniqueKey, out long keyIndex, out int segmentIndex)
        {
            long ticks = BitConverter.ToInt64(timestampBinary, 0);

            byte[] array;
            if (Canary15DataManager.GetEntry(ticks, out array, out keyIndex, out segmentIndex))
            {
                byte[] bytes = new UnicodeEncoding().GetBytes(logOnUniqueKey);
                int    num   = userContextIdBinary.Length + timestampBinary.Length + bytes.Length;
                num += array.Length;
                byte[] array2 = new byte[num];
                int    num2   = 0;
                userContextIdBinary.CopyTo(array2, num2);
                num2 += userContextIdBinary.Length;
                timestampBinary.CopyTo(array2, num2);
                num2 += timestampBinary.Length;
                bytes.CopyTo(array2, num2);
                num2 += bytes.Length;
                array.CopyTo(array2, num2);
                byte[] result;
                using (SHA256Cng sha256Cng = new SHA256Cng())
                {
                    result = sha256Cng.ComputeHash(array2);
                    sha256Cng.Clear();
                }
                return(result);
            }
            return(null);
        }
Ejemplo n.º 2
0
 static Canary15DataSegment()
 {
     Canary15Trace.TraceDateTime(Canary15DataSegment.UtcNow, 0, "Canary15DataSegment().UtcNow.");
     Canary15Trace.TraceTimeSpan(Canary15DataSegment.defaultRefreshPeriod, 1, "Canary15DataSegment().defaultRefreshPeriod.");
     Canary15Trace.TraceTimeSpan(Canary15DataSegment.ReplicationDuration, 2, "Canary15DataSegment().ReplicationDuration.");
     Canary15DataSegment.topoConfigSession      = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(false, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 119, ".cctor", "f:\\15.00.1497\\sources\\dev\\clients\\src\\common\\Canary15DataSegment.cs");
     Canary15DataSegment.adClientAccessObjectId = Canary15DataSegment.topoConfigSession.GetClientAccessContainerId();
     Canary15DataSegment.LoadClientAccessADObject();
     byte[] array  = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest().ObjectGuid.ToByteArray();
     byte[] array2 = Canary15DataSegment.topoConfigSession.GetDatabasesContainerId().ObjectGuid.ToByteArray();
     Canary15DataSegment.adObjectIdsBinary = new byte[array.Length + array2.Length];
     array.CopyTo(Canary15DataSegment.adObjectIdsBinary, 0);
     array2.CopyTo(Canary15DataSegment.adObjectIdsBinary, array.Length);
     if (Canary15Trace.IsTraceEnabled(TraceType.DebugTrace))
     {
         using (SHA256Cng sha256Cng = new SHA256Cng())
         {
             byte[] bytes = sha256Cng.ComputeHash(Canary15DataSegment.adObjectIdsBinary);
             Canary15Trace.TraceDebug(2L, "adObjectIdsBinaryHash:{0}", new object[]
             {
                 Canary15DataSegment.GetHexString(bytes)
             });
             sha256Cng.Clear();
         }
     }
 }
Ejemplo n.º 3
0
        // Token: 0x060007AA RID: 1962 RVA: 0x0003A52C File Offset: 0x0003872C
        static Canary()
        {
            ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(true, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 78, ".cctor", "f:\\15.00.1497\\sources\\dev\\clients\\src\\owa\\bin\\core\\Canary.cs");

            byte[] array  = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest().ObjectGuid.ToByteArray();
            byte[] array2 = topologyConfigurationSession.GetDatabasesContainerId().ObjectGuid.ToByteArray();
            Canary.adObjectIdsBinary = new byte[array.Length + array2.Length];
            array.CopyTo(Canary.adObjectIdsBinary, 0);
            array2.CopyTo(Canary.adObjectIdsBinary, array.Length);
            if (ExTraceGlobals.UserContextTracer.IsTraceEnabled(TraceType.DebugTrace))
            {
                using (SHA256Cng sha256Cng = new SHA256Cng())
                {
                    byte[] bytes = sha256Cng.ComputeHash(Canary.adObjectIdsBinary);
                    ExTraceGlobals.UserContextTracer.TraceDebug <string, string>(2L, "{0}.Canary(): adObjectIdsBinaryHash={1}", "Owa.Core.Canary", Canary.GetHexString(bytes));
                    sha256Cng.Clear();
                }
            }
        }
Ejemplo n.º 4
0
        private static byte[] Init()
        {
            ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(true, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 112, "Init", "f:\\15.00.1497\\sources\\dev\\clients\\src\\common\\CryptoMessage.cs");

            byte[] array  = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest().ObjectGuid.ToByteArray();
            byte[] array2 = topologyConfigurationSession.GetDatabasesContainerId().ObjectGuid.ToByteArray();
            byte[] array3 = new byte[array.Length + array2.Length];
            array.CopyTo(array3, 0);
            array2.CopyTo(array3, array.Length);
            if (ExTraceGlobals.CryptoTracer.IsTraceEnabled(TraceType.DebugTrace))
            {
                using (SHA256Cng sha256Cng = new SHA256Cng())
                {
                    byte[] bytes = sha256Cng.ComputeHash(array3);
                    ExTraceGlobals.CryptoTracer.TraceDebug <string, string, string>(0L, "{0}.{1}: adObjectIdsBinaryHash={2}", "Clients.Common.CryptoMessage", "CryptoMessage()", CryptoMessage.GetHexString(bytes));
                    sha256Cng.Clear();
                }
            }
            return(array3);
        }
Ejemplo n.º 5
0
        // Token: 0x060007B8 RID: 1976 RVA: 0x0003A87C File Offset: 0x00038A7C
        private static byte[] ComputeHash(byte[] userContextIdBinary, byte[] timeStampBinary, string logonUniqueKey)
        {
            int num = 0;

            byte[] bytes = new UnicodeEncoding().GetBytes(logonUniqueKey);
            byte[] array = new byte[userContextIdBinary.Length + timeStampBinary.Length + bytes.Length + Canary.adObjectIdsBinary.Length];
            userContextIdBinary.CopyTo(array, num);
            num += userContextIdBinary.Length;
            timeStampBinary.CopyTo(array, num);
            num += timeStampBinary.Length;
            bytes.CopyTo(array, num);
            num += bytes.Length;
            Canary.adObjectIdsBinary.CopyTo(array, num);
            byte[] result;
            using (SHA256Cng sha256Cng = new SHA256Cng())
            {
                result = sha256Cng.ComputeHash(array);
                sha256Cng.Clear();
            }
            return(result);
        }