Reputation: 57
My java application stores data in a folder at user home directory. How can i encrypt that folder but access the encrypted folder with an application?
I tried to encrypt the folder with java, (Java Cryptography Extension (JCE)), but cannot access this folder from within my application without decrypting it.
I need the user to have no access to this folder, only within my application.
Upvotes: 1
Views: 277
Reputation: 22128
Note: This is going to be a bit of an unorthodox answer, and might not be exactly what the OP is looking for.
One possible solution is to zip the files in your folder, and then encrypt the zip file. Reading its contents will be slower of course, but is perfectly feasible with Java's NIO Zip File system provider. You will need to decrypt it back so that it is back to zip format.
https://docs.oracle.com/javase/8/docs/technotes/guides/io/fsp/zipfilesystemprovider.html
Not sure how frequently the files will change by the application, and how feasible it is to update the zip file and re-encrypt it for what is needed.
Upvotes: 1