Esempio n. 1
0
 private byte[] ComputeHash(byte[] userContextIdBinary, byte[] timeStampBinary, string logonUniqueKey, out string logData)
 {
     Canary15.CanaryKind canaryKind = Canary15.GetCanaryKind(timeStampBinary);
     byte[] result;
     byte[] bytes = new UnicodeEncoding().GetBytes(logonUniqueKey);
     result = this.ComputeHmac(new byte[][] {
         userContextIdBinary,
         timeStampBinary,
         bytes
     });
     logData = Canary15.FormatLogData(canaryKind);
     return(result);
 }
Esempio n. 2
0
        private void Init(byte[] userContextIdBinary, byte[] timeStampBinary, string logonUniqueKey, byte[] hashBinary, string logData)
        {
            long canaryTicks = Canary15.GetCanaryTicks(timeStampBinary);

            this.kind            = Canary15.GetCanaryKind(timeStampBinary);
            this.CreationTime    = new DateTime(canaryTicks, DateTimeKind.Utc);
            this.IsRenewed       = false;
            this.IsAboutToExpire = Canary15.IsNearExpiration(canaryTicks);
            byte[] array = new byte[userContextIdBinary.Length + timeStampBinary.Length + hashBinary.Length];
            userContextIdBinary.CopyTo(array, 0);
            timeStampBinary.CopyTo(array, userContextIdBinary.Length);
            hashBinary.CopyTo(array, userContextIdBinary.Length + timeStampBinary.Length);
            this.UserContextId  = new Guid(userContextIdBinary).ToString("N");
            this.LogonUniqueKey = logonUniqueKey;
            this.canaryString   = Canary15.Encode(array);
            this.LogData        = logData;
        }