// Token: 0x06000CDD RID: 3293 RVA: 0x000356B4 File Offset: 0x000338B4 public bool ValidateAuthenticationString(string authenticationString) { if (this.currentSecretKey == null) { throw new InvalidOperationException("Current secret key was not set"); } if (string.IsNullOrEmpty(authenticationString)) { return(false); } byte[] array = null; try { array = Convert.FromBase64String(authenticationString); } catch (FormatException) { return(false); } if (array.Length < 9) { return(false); } if (array[0] != 0) { return(false); } long longFromBlobTail = DatacenterServerAuthentication.GetLongFromBlobTail(array); if (ExDateTime.Now.UtcTicks - (long)((ulong)-1294967296) > longFromBlobTail) { return(false); } bool result = false; byte[] hashedValue = this.GetHashedValue(this.currentSecretKey, array, 1, 16, longFromBlobTail); if (array.Length != 17 + hashedValue.Length + 8) { return(false); } if (DatacenterServerAuthentication.HashesMatch(hashedValue, array, 17)) { result = true; } else if (this.previousSecretKey != null) { hashedValue = this.GetHashedValue(this.previousSecretKey, array, 1, 16, longFromBlobTail); if (array.Length == 17 + hashedValue.Length + 8) { result = DatacenterServerAuthentication.HashesMatch(hashedValue, array, 17); } } return(result); }
// Token: 0x06000CE2 RID: 3298 RVA: 0x000358F8 File Offset: 0x00033AF8 private byte[] GetHashedValue(byte[] secretKey, byte[] arrayContainingNonce, int nonceStartOffset, int nonceByteLength, long timestamp) { byte[] array = new byte[secretKey.Length + nonceByteLength + 8]; Array.Copy(secretKey, array, secretKey.Length); Array.Copy(arrayContainingNonce, nonceStartOffset, array, secretKey.Length, nonceByteLength); DatacenterServerAuthentication.SetBlobTailToLong(array, timestamp); byte[] result; using (SHA256Cng sha256Cng = new SHA256Cng()) { result = sha256Cng.ComputeHash(array); } return(result); }
// Token: 0x06000CDC RID: 3292 RVA: 0x00035634 File Offset: 0x00033834 public string GenerateCustomAuthenticationString(byte[] nonce, long timestamp) { if (nonce == null) { throw new ArgumentNullException("nonce"); } if (this.currentSecretKey == null) { throw new InvalidOperationException("Current secret key was not set"); } byte[] hashedValue = this.GetHashedValue(this.currentSecretKey, nonce, 0, nonce.Length, timestamp); byte[] array = new byte[1 + nonce.Length + hashedValue.Length + 8]; array[0] = 0; Array.Copy(nonce, 0, array, 1, nonce.Length); Array.Copy(hashedValue, 0, array, 1 + nonce.Length, hashedValue.Length); DatacenterServerAuthentication.SetBlobTailToLong(array, timestamp); return(Convert.ToBase64String(array)); }