简体   繁体   English

如何加密文件(视频/音频/图像),保存到SDCard,然后解密该文件并通过VideoView播放?

[英]How can I encrypt a file (video/audio/image), save to SDCard, then decrypt that same file and play it via VideoView?

I am trying to create an app that would download a file from a remote server and save it to the SD card. 我正在尝试创建一个将从远程服务器下载文件并将其保存到SD卡的应用。 The file is quite confidential so I need an encryption for this. 该文件非常机密,因此我需要对此进行加密。 I would like it to be saved as encrypted. 我希望将其另存为加密文件。 When I want to play the file, it should only be played on my media player which has the decrypt code. 当我要播放文件时,只能在具有解密代码的媒体播放器上播放该文件。 No other player can play that file. 没有其他播放器可以播放该文件。 How is this possible? 这怎么可能? Thanks for any suggestions you may have. 感谢您的任何建议。

If you don't want to be bothered with a delay by decrypting the entire file before to be able to start the playing, you should consider a streaming architecture. 如果您不希望在开始播放之前先解密整个文件而感到延迟,则应考虑使用流式传输体系结构。 A typical design involves the javax.crypto.CipherInputStream class and a local http instance. 一个典型的设计涉及javax.crypto.CipherInputStream类和一个本地http实例。 For an example of that kind of design, look at something like LocalSingleHttpServer. 有关这种设计的示例,请查看类似LocalSingleHttpServer的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM