General discussion

Locked

Password protect a file

By nise_k ·
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.

This conversation is currently closed to new comments.

6 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Password protect a file

by dmiles In reply to Password protect a file

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

Collapse -

Password protect a file

by nise_k In reply to Password protect a file

The first URL is not of my use, and the 2nd one doesn't work.

Collapse -

Password protect a file

by nise_k In reply to Password protect a file

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.

Collapse -

Password protect a file

by falcon1 In reply to Password protect a file

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

Collapse -

Password protect a file

by nise_k In reply to Password protect a file

Poster rated this answer

Collapse -

Password protect a file

by nise_k In reply to Password protect a file

This question was closed by the author

Back to Web Development Forum
6 total posts (Page 1 of 1)  

Related Discussions

Related Forums