/// <summary> /// Gets keys for the serial file, or decendant. /// </summary> /// <param name="SerialFile">SerialFile reference, or decendant.</param> /// <param name="Provider">Provider of encryption keys.</param> protected static async Task GetKeys(SerialFile SerialFile, FilesProvider Provider) { if (SerialFile.encrypted) { SerialFile.aes = Aes.Create(); SerialFile.aes.BlockSize = 128; SerialFile.aes.KeySize = 256; SerialFile.aes.Mode = CipherMode.CBC; SerialFile.aes.Padding = PaddingMode.None; KeyValuePair <byte[], byte[]> P = await Provider.GetKeys(SerialFile.fileName, SerialFile.fileExists); SerialFile.aesKey = P.Key; SerialFile.ivSeed = P.Value; SerialFile.ivSeedLen = SerialFile.ivSeed.Length; } }