If I understand correctly you are downloading the image first
BufferedInputStream bis = new BufferedInputStream(is);
bm = BitmapFactory.decodeStream(bis);
Then saving it to a file with PNG compression:
bm.compress(Bitmap.CompressFormat.PNG, 100, outStream);
And AFTER that doing your decryption on the file, right?
I think you might want to decrypt the bytes prior to saving them as a png, or maybe even prior to using the decodeStream. Otherwise you are decrypting the encrypted bytes that decode stream and PNG compression messed with.
Try skipping all of the BitmapFactory stuff and just save the initial file as-is, and then run your decryption. In your AsyncTask:
String saveFilePath = <path to the temporary encrypted file>;
FileOutputStream outputStream = new FileOutputStream(saveFilePath);
int bytesRead = -1;
byte[] buffer = new byte[4096];
while ((bytesRead = is.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead);
}
outputStream.close();
inputStream.close();
Then run your decryption stuff on the saved file