Sawing the app on Xamarin. Normal activity with the vyuha. Encrypt files using the AES algorithm, the encryption method used here is a (decoding similar):
public static void Encode(string inputPath, string outputPath, string _key, string _iv)
using (Aes aes = Aes.Create())
aes.Key = Encoding.Unicode.GetBytes(_key);
aes.IV = Encoding.Unicode.GetBytes(_iv);
using (Stream s = File.OpenWrite(outputPath))
using (CryptoStream cs = new CryptoStream(s, aes.CreateEncryptor(), CryptoStreamMode.Write))
byte data = File.ReadAllBytes(inputPath);
cs.Write(data, 0, data.Length);
The paradox is that on Android 4.4, everything works perfectly. Files (including non-images, just text) encrypted and decrypted perfectly. The Method BitmapFactory.DecodeFile correctly generates a picture from the decoded files.
But on Android versions 5.0 and above there is the following:
text files normally generated, encrypted and decrypted. But with pictures trouble - BitmapFactory.DecodeFile returns null. This occurs if you feed him the decrypted image. With the previously unencrypted images this method is working properly.
In what direction to dig?