Making a folder lock application using java - java

I've got a project from my college to make a folder lock application using Java.
I have no idea how to go about it. Please give some clues on how to make a folder\file password protected ?.

It is totally native dependent.
You need to protect/encrypt/hide the folder using native features.
and if your app validates the user reverse the process

A daemon thread or service will be running,for lock folder management that is for locking,unlocking, displaying alerts etc..
Going with fast and efficient encryption and decryption algorithm is also another challenge as the number of files in the folders grow ,the efficiency should not decline.
At the same time,users and password list should be secured which should not be os dependents. File tampering etc should also be dealt with !!

If you dont want it dependent on a specific OS you can go this way:
zip it using:
http://download.oracle.com/javase/1.3/docs/api/java/util/zip/package-summary.html
encrypt it using:
http://download.oracle.com/javase/1.4.2/docs/guide/security/CryptoSpec.html
delete safely the original data by first replacing all the characters in the files with random data and then deleting those files.

Related

How do I store data in Java without need of extra software?

I am currently developing a program in Java using NetBeans that manages expenses. In this program I used MySQL to store data. Now I want to ask that if I give the program to one of my friend, he would also have to install MySQL using the same password that I used. Is there a way in which he will not be required to install MySQL?
Now suppose if my friend already has MySQL, but with a different password. My program would not work in that case, and it would be hard to replace my password with his password in the code. Is there a way to make the program run on his PC?
Earlier once, I have used an Oxford dictionary program. That time I did not have Microsoft Access installed. When I installed Microsoft Access I came to know that all the words of the dictionary are stored in a Microsoft Access file. How can I do this? I.e. how can I use MySQL/Microsoft Access to store data without the need to install either of them?
You can use an in-memory database like H2 Database if you don't require a large amount of data
But I think you should make your db connection configurable by using a properties file
If you want everyone to be able to use the database, you need to run it on a server that people can access through the internet.
However if you don't care about them using the same database and just want them to use their own, you could for example create a small file named "config.ini" or something like that and put the login information (like the password) in there.
Then just read it in your code and use the info you read to log into your database.
That way, every new user will only have to change the config.ini file without ever having to touch the code.
The best solution in my opinion would be SQLite as it is light, and data can be stored locally in a desired location in a single file. H2 is more likely to be a developer tool.
This solution does not require additional software to be present on the user machine. Of course it has its limits, but as a simply storage for program dynamic data it is a good solution. It is worth mentioning that Android applications also can store their data in LiteSQL. It is a bit different approach there, but the principle stays the same.

Java encryption on-the-fly by virtual drive

I have made an encryption system and I'm looking for a way to add some way to integrate it with file system on windows(if possible also on linux). I don't want to rise a debate whether it is needed, that it already exists etc...
I was hoping to find a way to mount a virtual disk drive that will be able to access the files in the decrypted form, encrypt and decrypt on the fly using my software, it is currently written in java, but if needed I can port it to c++.
I have found one way to do it, which is to run a java ssh server and use another software to mount it in windows, but it doesn't work work well, constant crashes or it sometimes just doesn't mount the drive.
I need it as I want to access the files using IDE and other programs without coping the files as it decreases the security and doubles the disk space used.
Has anyone found a way to do it preferably in java?
Is there some kind of API for it (all I need is list files, get parent, read file, write file)?
Or is there a good java lib what works with another program to do it?

protect data from extraction from setup.exe or from jar

I am making the setup of java swing application by using Inno Setup as an exe i am selecting the jar file of my project, I am also adding other necessary resources as folder.
When I am installing the setup on the client side. it is putting the jar and other
resources in program files folder but there client can extract the my java classes
and other resources from jar. I want that client can only use the resources by
application program but he could not extract the resources. How is it possible?
There is literally nothing you can do to entirely prevent someone from extracting the resources.
The best you can do is to make the process a bit difficult; e.g. by storing the resources in the JAR file in encrypted form. The problem is that your program would need to decrypt the resources in order to use them. Someone with sufficient skills and patience can reverse engineer your decryption code and capture the unencrypted resources.
By the way, this is not a Java-specific problem. Any application that you provide to a user as an executable can be reverse engineered ... assuming that the user has the wherewithal to run it in the first place.
The bottom line is that if you are not prepared for the possibility that someone might extract the resources, you should not distribute the executable.

encrypt html files using java swing

I am working on a Swing application in which i have to give the HTML files to client but I dont want the client to get access to them.
Is there any way that I can put my files either in password protected folder or I could encrypt the file and my program should access them back in the Swing application.
You could encrypt them with a shared hidden key.
One for your application, hardcoded in the software, one for yourself, to encrypt the html files with.
That's about all you can do about it. Once decrypted it is fairly easy to get the contents from it because they can always write their own class which implements your class that simply shows the content(it's about 15 lines of code really, java decompilers work pretty good these days)
Hehe, well that's of course technically possible, but at some point the cleartext will be available to your client - if not by other means, then at least by network sniffing...
Use your resources to write good code and don't bother encrypting your HTML.
Cheers,

Get notify before file is deleted

I am using Java language
What I want is that Can any one help me to write a code that
When i click on delete option of any file or folder I get notify before delete that I ma deleting a file Whether I want to continue ?
I have seen many examples that notify after the file is deleted.
One thing I want to make clear is as I click on file placed Desktop or My document directory I must get notify that
You are deleting a file .do you want to continue ?
What I really need is I want the exact answer or code
Please help
I shall be very thankful to you
No, this is not possible in Java. The operating system handles the file access, and another process is not capable of preventing the system denying access to those files. The only way you could do this is by having a file system written in Java (say, a loopback mounted WebDAV share) to which you could intercept the file requests with this kind of information. But not only would this be difficult to achieve, it also would only work if all of the access you are doing is via your loopback mounted system; it wouldn't work for files located on the disk or from other network shares.
So, in summary, you cannot do this with any programming language without writing your own filesystem and using that to intercept requests.

Categories