Password protect a file
Hi friends,
Is there any way to Protect a file by setting Password for it? And, also how to access such files programatically.
Thanx in advance.
Web Development
Hi friends,
Is there any way to Protect a file by setting Password for it? And, also how to access such files programatically.
Thanx in advance.
by dmiles
This depends on the Operating System you have installed on the machine Window9X does not have the capability to password protect files or folders,you would need to use a third party software such as:
Win Zip
Script Mate User Manager
Reference sites
1)www.novia.net/~tomcat/HowTo/password.html
2)www.softfolder.com/ppwl.html
by nise_k
by nise_k
The OS is Win 95. And, the problem is -
Through my JSP program, I am writing few log
data into a text file. Now, I don't want anyone else to read the contents of this file. So, when someone tries to open it, it should first ask for a password.
Also, I don't want to Encrypt and Decrypt through my programs.
by falcon1
Hi,
what you could do is to write the logs into an object, and set the data fields to private and make use of a getData method like:
public class Protect
{
private object Data = "null";
private String password = "null"
public object setData (object)
{
Data = object;
}
public setPass(String a)
{
password = a;
}
public "object" getData (String a)
{
if(a == password){ return data }
else { return null } // or fony data
}
and then write the entire objet to a file
FileOutputStream ostream = new FileOutputStream("t.tmp");
ObjectOutputStream p = new ObjectOutputStream(ostream);
p.writeObject("Data");
p.flush();
ostream.close();
of course the data isn't enqripted so its not safe from hackingat all. but it is'nt readable in directly.
good luck
Mike Valk
by nise_k
by nise_k
This discussion is closed to new replies.
Sort by Trending