Пример #1
0
        public static bool ValidateCanary15(string canaryString, string logonUniqueKey)
        {
            byte[] userContextIdBinary;
            byte[] array;
            byte[] array2;
            if (!Canary15.ParseCanary15(canaryString, out userContextIdBinary, out array, out array2))
            {
                ExTraceGlobals.CoreTracer.TraceDebug <string>(10L, "ValidateCanary failed, canaryString={0}", canaryString);
                return(false);
            }
            if (Canary15.IsExpired(array))
            {
                ExTraceGlobals.CoreTracer.TraceDebug <string>(10L, "Canary is expired, timeStampBinary={0}", Canary15.GetHexString(array));
                return(false);
            }
            long num;
            int  num2;

            byte[] array3 = Canary15DataManager.ComputeHash(userContextIdBinary, array, logonUniqueKey, out num, out num2);
            if (Canary15.AreEqual(array2, array3))
            {
                return(true);
            }
            ExTraceGlobals.CoreTracer.TraceDebug <string, string>(10L, "testHashBinary={0}!=hashBinary={1}", Canary15.GetHexString(array3), Canary15.GetHexString(array2));
            return(false);
        }
Пример #2
0
 public static Canary15 RestoreCanary15(string canaryString, string logonUniqueKey)
 {
     byte[] userContextIdBinary;
     byte[] array;
     byte[] array2;
     if (Canary15.ParseCanary15(canaryString, out userContextIdBinary, out array, out array2))
     {
         if (Canary15.IsExpired(array))
         {
             ExTraceGlobals.CoreTracer.TraceDebug <string>(5L, "Canary is expired, timeStampBinary={0}", Canary15.GetHexString(array));
             return(null);
         }
         long   keyIndex;
         int    segmentIndex;
         byte[] array3 = Canary15DataManager.ComputeHash(userContextIdBinary, array, logonUniqueKey, out keyIndex, out segmentIndex);
         if (Canary15.AreEqual(array3, array2))
         {
             return(new Canary15(userContextIdBinary, array, logonUniqueKey, array2, Canary15.FormatLogData(keyIndex, segmentIndex)));
         }
         ExTraceGlobals.CoreTracer.TraceDebug <string, string>(5L, "testHashBinary={0}!=hashBinary={1}", Canary15.GetHexString(array3), Canary15.GetHexString(array2));
     }
     ExTraceGlobals.CoreTracer.TraceDebug <string, string>(5L, "RestoreCanary failed, logonUniqueKey={0}, canaryString={1}", logonUniqueKey, canaryString);
     return(null);
 }