I am creating android application which contains DB that needs to be hidden(not able to access by the user)in the SD Card. Can anyone tell me how to do this?
Any file stored on the SD card is accessible both by applications running on the phone, and by users who have mounted the SD card (both while it's in the phone and otherwise).
You can change the file properties to make it 'hidden', but it will still be easily found. There is no way to make a file on a public partition like an SD Card 'secure' in the manner you describe - users will always be able to copy, delete, and potentially change the file.
The best solution to your problem is to look into ways to encrypt your database to record it securely. You won't be able to prevent users from deleting or copying the file, but you should be able to make it difficult for them to read data from it or modify its contents.
For an easy solution, just prefix the db file with a . (like .dbfile). This will hide the file on Linux based systems, including android.
I am assuming that you want to hide the file to prevent users from accidentally deleting/changing it.
SD cards cannot be secured in the fashion you seek.
just name the file start by ."Dot"... ".myFolder/.myfile"
You can create a folder whose name starts with a dot(.) example (.dbfiles) android See these folders as configuration folder and do not show content of these folder in applications like gallery,music player...You can see these folders with advance file explorer like Es File explorer
Sdcard you cant't! Internal app data partition is the place for you.
Related
So I have some files I want my Android App to access, read and write.
I want to store it internally. Where can I put these files in my Java Project so they are accessible or can this not be done?
There are three ways to achieve this, and according to your requirements select the approch
on SDCARD
This is the normal SDCARD/in-build SDCARD in newer smart phones. you need to create specific folder structure and put your files there, here you can do file read and write both
but this in insecure because accessible to all the application
on Internal Storage
This is given as Applicaiton specific storage where you can create the file and do the operation, this is most secure way to do it, but this is generated run time so you can not push the files directly, you can put your files in RAW or ASSETS and copy that here
RAW and ASSETS
This is in the code structure only and only read access is given to this folder, you can not change this file run time.
if you select any one of this approach then simple goggling will show you the sample code.
You can read or write files in the path of your internal storage as
data/data/package_name/files . I had already answered a similar question you can check it out.
How can we completely delete files in Android?
For Android, the ROM is exFAT, sdcard has FAT32/ext3, ext4 file format.
I want to remove a selected file completely, so you can not recover it. Do you know of a solution?
I'm not even going to ask why you want to do this.
Simply writing zeros over top of the file before deleting it should be considered "good enough".
From there, you are going to have to do some serious filesystem manipulation to try and write data on top of the area where the file was previously located. With a large flash device, we could be talking several Gigabytes before the previous content is permanently destroyed.
As SD-card is used under the file system, there is no guarantee, that you will have no pieces of the file. At least, I think that it is possible, that SD card will function like SSD disk: it can move sectors transparently for you. But there is a try :)
You can delete the file you want, then create a file which will fill all the space available on sd-card, and fill that file by zeros. Then you can delete that file too.
It's really old question but if someone is getting redirected here then please use following apps
Secure Delete: https://play.google.com/store/apps/details?id=com.peterhohsy.securedelete
or
Secure Wipe: https://play.google.com/store/apps/details?id=com.pinellascodeworks.securewipe
depending on your requirement
I want to develop an application which lets user protect their files / folders . It is very much the same as existing apps where user can select the files to be hidden and those files can be accessed only from my app which is password protected.
I got enough resources about the encryption algorithm.
Here my doubt is :
where should i keep my encrypted files. It should be within my app folder. But this folder if i create on phones internal storage, will that not lead to memory restrictions. My app let user to add images / videos or any other file to protection. If i keep the folder on the sd card, the questions are it will restrict app to be run on only mobiles with sd card . Also the content of sd card can be accessed by others ( i am right here ? )
The next doubt is that i see most of those apps i see if i remove protection it is restored in its previous folder. How is it achieved . Is it like keep mapping table an duse that to restore ?
Please help me with answers for my questions. Thanks a lot for your time and help
According to my investigations of the same problem, there is no built-in encrypted storage in Android system. Hence, I'd recommend you following approach:
Encrypt file content with any algorithm. See here(1), here(2) and here(3).
Use MODE_PRIVATE when creating file with, for example, openFileOutput(String, int)
I'd like to take a few zip files - file1.zip file2.zip file3.zip etc. and create an APK file which contains them and when installed simply copies them to a specified directory on the sd card of the phone.
Can this be done in just a few lines of code? I really appreciate any input. Thank you.
Anything you put in res/raw is available as a resource you can work with once your app is installed. I'm curious why you want to move zip files to the device without having a "real" app to go with them.
I have an application which writes and reads from a specific file on the SD card.
What i would like is a way to encrypt the whole SD card or a minimum of That specific folder. So if the phone is stolen no one can read the content of that folder.
However, i also want the application to still be able to interact with the folder and the password isn't required until someone looks at the folder specifically (using astro etc) or inserts it into a PC to view.
Is this possible? thanks
You'll need to do this manually, look into javax.crypto for getting the crypto bit done relatively painlessly.
This won't be possible with an ordinary (unmodified) android system (I assume).
If you are talking about your own app - you could implement your own file level encryption in your application.
For everything else, I'd say you need to modify android to include some kind of encrypted file system and the relevant UI for it.