简体   繁体   English

Android中的密码保护文件夹

[英]Password protect folder in android

I want to store media files in an external storage creating a folder . 我想将媒体文件存储在创建文件夹的外部存储中。 The folder is secured using a password and accessible by my app only. 该文件夹使用密码保护,并且只能由我的应用访问。 The user is allowed to create its own password. 允许用户创建自己的密码。 Any suggestions how to do this?? 任何建议如何做到这一点?

I don't think your approach is possible. 我认为您的方法不可能。 Maybe you should think about encrypting the file contents, so that only your app will be able do access the actual content after decryption. 也许您应该考虑加密文件内容,以便只有您的应用程序才能在解密后访问实际内容。

Encrypting files is not a solution! 加密文件不是解决方案! This only creates potential file loss and problems later. 这只会造成潜在的文件丢失和以后的问题。 Also, it is slow and you rely on the app that encrypted the files to unencrypt them later. 此外,它的速度很慢,并且您依赖于对文件进行加密的应用程序,以后再将其解密。 What if that app dies or is not longer available? 如果该应用程序死了或不再可用怎么办? You have lost your files. 您丢失了文件。

External storage such as the SD card has no permissions associated with it. 外部存储设备(例如SD卡)没有与其关联的权限。 The closest you could do is to store your data in some encrypted form and as per requirement you can decrypt it also. 您能做的最接近的就是以某种加密形式存储数据,并且根据要求您还可以解密它。

This is the link for how you can encrypt and decrypt your file. 是您如何加密和解密文件的链接。

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

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