I'm writing a small Java application similar to TrueCrypt, it is a container with encrypted user files.
There is a problem with access to encrypted files. At the moment, I'm using this approach:
1. When connecting the container completely decrypt all files in a common folder.
2. Mount folder as a drive.
3. Watch the events in a folder decrypt files using WatchService.
4. For example, when adding a new file is encrypted, and it is stored in the container.
5. After disconnecting the container delete all encrypt files and unmount folder.
I would like to find a solution that would allow to decrypt only the files that the user wants to use, such as providing the user access only to the names of the files, and when the user wants to use to decrypt only one file.
The requirements are: to use only native system file manager, don't write own file manager, a decision should be cross-platform.
At the moment, there is an idea to implement the FTP protocol, or WebDAV and mount it as a network drive.
Is there a simple and elegant solution?
One possibility would be to encrypt each file in the container separately. Encrypt the directory separately as well. When connected, just decrypt the directory file for the user to see. Other files are decrypted/encrypted as the user opens and saves them. Use a similar process for subdirectories if any are present.
This is more complex to run than encrypting the whole container in a single large encrypted file. It will also impose a delay on individual file access due to en/decryption.
Related
I am developing an application to download files online, save them on internal storage, and read them once installed. Moreover, my client have requested than the files are encrypted.
Actually I have developed a working version that do the following :
Download process :
1) Download the File on internal storage
2) create a new encrypted file from the original one, and save it in the internal folder
3) Delete the original one
Opening process :
1) Create a Decrypted file from the encrypted one and save it in the internal storage
2) Open the decrypted file with the correct viewer
3) Delete the decrypted file once the user stop reading it.
Here is my question:
I am actually using activityForResult and an Intent ACTION VIEW to open the decrypted file from the internal storage.
First of All, I don't like using an ActivityForResult on an ACTION VIEW Intent because it is handled by a external app, Secondly the user keep the decrypted file if he leave the app from the viewer.
How Can I Create a temporary file from my decrypted file which will be destroy after the user finish reading it?
The downloaded files needs to be readable offline, so streaming is not an option.
EDIT: SOLUTION
The only solution is to take control of the Intent, so that the ActivityForResult can be used safely here. Therefore, the viewer must be implemented in the application. If the files are not common files, as my case, you should develop your own reader/viewer. This allows you to completely control what your application is doing and when your files will be deleted.
I want to access a file server that is not present in my network, but I have credentials of other domain that can be used to access the file.
How do I gain access to the file in share?
Is it possible to gain access to the file using a java program?
Operating System is Windows. I want to read the contents from .txt and .csv files present in the share and display it on a web page.
I used jcifs library to solve this. It works great.
You can use ftp protocol.
And also can make a map drive from share folder on your system. It's a simple solution.
Part of the application I'm working connects to an instance using ssh. It requires a .ppk file which I've currently got stored in S3.
My concern is that it's not secure enough and I'm looking for a method in which to make it so.
I've considered encrypting the S3 bucket and allowing programmatic access only, the bucket and file location can be fed to app via env variables.
I really don't want to keep the file in the resources as anyone getting the jar cam unzip and obtain, same with hardcoded values in the codebase. Is this a safe way of storing this file? Would encrypting it be worth the additional steps?
How to read and write files from a protected shared folder on another device using Java?
I'm currently working on a backup program which backups all the computers we use at home to a NAS system. This NAS has a shared folder which is used to store the backup files in. This shared folder is protected with a username and password.
I would like to read and write files to this system using Java. Reading and writing files is easy, the problem is though, it isn't possible to read and write files from this shared folder because user credentials are required. How to I login automatically on this shared folder with supplied user credentials using Java, before using this shared folder?
So, the problem doesn't have anything to do with the file path I should be using, or the way I should reach this folder. The problem I have is, that the Java program needs to login automatically on this shared folder with supplied user credentials before reading or writing any files from this external file system.
We have a web application that allows user to download a zip file from a web server. We just provide dummy iframe source to the full URL of zip file on web server. This approach would allow end user to use browser controls which allows the user to open or save the zip to user's local machine.
We have a requirement that the zip file is automatically extracted and save to a specific location on user's machine. Any thoughts on how this can be achieved?
Thanks.
I highly doubt that you'll be able to do that. The closest you're likely to get is to generate a self-extracting executable file (which would be OS-dependent, of course).
I certainly wouldn't want a zip file to be automatically extracted - and I wouldn't want my browser to be able to force that decision upon me.
Short answer is I don't believe this is possible using the simple URL link you've implemented.
Fundamentally the problem you have is that you have no control over what the user does on their end, since you've ceded control to the browser.
If you do want to do this, then you'll need some client-side code that downloads the zipfile and unzips it.
I suspect Java is the way to go for this - Javascript and Flash both have problems writing files to the local drive. Of course if you want to be Windows only then a COM object could work.
Instead of sending a zip file why don't u instruct the web server to compress all the web traffic and just send the files directly?
See http://articles.sitepoint.com/article/web-output-mod_gzip-apache# for example.