如何解密 Android DownloadManager 下载的文件?

How to decrypt files downloaded by Android DownloadManager?

我正在使用 E2E 加密在 Android 设备之间发送文件。

有没有办法使用 DownloadManager 下载加密文件并在将文件保存到磁盘之前立即解密文件?

据我了解,唯一的解决方案是使用 BroadcastReceiver 来检测已完成的下载。但这意味着应用程序必须打开,用户可能会进入下载完成但文件已损坏的状态,因为它尚未解密。

有没有另一种方法可以在后台完全解密文件,而不使用广播接收器?

Is there a way to download an encrypted file using the DownloadManager and immediately decrypt the file before saving it to the disk?

没有。 DownloadManager 将自行保存到磁盘。

To my understanding, the only solution is to use BroadcastReceiver for detecting finished downloads.

到那个时候,下载的内容将保存到磁盘。

Is there another way to decrypt the file completely in the background, without using a broadcast receiver?

使用 HTTP 客户端 API(例如 OkHttp)自行下载内容,并在下载时应用解密算法。