/// <summary> /// Decrypt with password /// </summary> /// <param name="input">Input stream</param> /// <param name="output">Output stream</param> /// <param name="password">Password</param> /// <param name="notifyProgression">Notify progression method</param> public static void DecryptWithPassword(Stream input, Stream output, string password, Action <int> notifyProgression = null) { input.Seek(5, SeekOrigin.Current); // Header input.Seek(1, SeekOrigin.Current); // Version byte ivLength = BinaryHelper.ReadByte(input); byte saltLength = BinaryHelper.ReadByte(input); byte[] iv = BinaryHelper.ReadBytes(input, ivLength); byte[] salt = BinaryHelper.ReadBytes(input, saltLength); if (notifyProgression != null) { notifyProgression(5 + 1 + 1 + 1 + ivLength + saltLength); } byte[] key = PBKDF2.GenerateKeyFromPassword(AES.KEY_SIZE, password, salt); AES.DecryptCBC(input, output, key, iv, _paddingStyle, notifyProgression); }