hi,
I want to create password protected files using java api so that when the user tries to open a file, he is prompted for a password and only when he enters the correct password should he be allowed to open that file.
How do i achieve this in java?
Any help regarding this will be highly appreciated !!
Creating password protected files through javajava
Page 1 of 1
8 Replies - 32237 Views - Last Post: 10 February 2010 - 10:47 PM
Replies To: Creating password protected files through java
#2
Re: Creating password protected files through java
Posted 09 January 2007 - 07:02 AM
The answer heavily depends on which way you want to open your protected files.
If it is opened by your (java) program, you can simply encrypt it with a password upon saving, and decrypt it with something the user provides, and use some checksum or header to see if the result is valid - or some garbage due to bad password, some crypto APIs will do it for you right out of the box - rtm.
On the otherhand, if you meant encrypting files with a program (like a notepad file, or something), and you expect windows or notepad to ask you for the password, then it depends on the format of the file you use. Some can be password protected, some can not -like text files usually associated with notepad). In this case password protection works as described in the format's own documentation, and you have to research it a bit. I think password protection of zip files is possible with the core Java API, but you'll have to find the corresponding libraries or develop your own ones in all other cases.
If it is opened by your (java) program, you can simply encrypt it with a password upon saving, and decrypt it with something the user provides, and use some checksum or header to see if the result is valid - or some garbage due to bad password, some crypto APIs will do it for you right out of the box - rtm.
On the otherhand, if you meant encrypting files with a program (like a notepad file, or something), and you expect windows or notepad to ask you for the password, then it depends on the format of the file you use. Some can be password protected, some can not -like text files usually associated with notepad). In this case password protection works as described in the format's own documentation, and you have to research it a bit. I think password protection of zip files is possible with the core Java API, but you'll have to find the corresponding libraries or develop your own ones in all other cases.
#3
Re: Creating password protected files through java
Posted 10 January 2007 - 12:03 AM
Thanks for the reply.
What i want is quite similar to your second point i.e.- I want to encrypt the file (which could be html,pdf,excel or ascii format) with a user saved password;save the file on the application unix server; and then send either the file (if its size is less than 2MB) or a link to the file location to the user in a mail. Now when the user tries to open this file, he should be prompted for a password and only if he enters the correct password should he be allowed to open the file.
I have found java apis which can achieve this for pdf and zip files. I was wondering if similar apis exist for the other formats as well?
What i want is quite similar to your second point i.e.- I want to encrypt the file (which could be html,pdf,excel or ascii format) with a user saved password;save the file on the application unix server; and then send either the file (if its size is less than 2MB) or a link to the file location to the user in a mail. Now when the user tries to open this file, he should be prompted for a password and only if he enters the correct password should he be allowed to open the file.
I have found java apis which can achieve this for pdf and zip files. I was wondering if similar apis exist for the other formats as well?
#4
Re: Creating password protected files through java
Posted 10 January 2007 - 05:39 AM
Good question, I think the OpenOffice libraries cover a pretty wide range of document formats, if you have the guts to dig into them. I'm not sure about the others.
However you could simply put every file into a password protected zip, although this way your users could save the files without the protection once uncompressed, and it would make putting password protection on the web access of the files more compelling, than protecting the files themselves.
However you could simply put every file into a password protected zip, although this way your users could save the files without the protection once uncompressed, and it would make putting password protection on the web access of the files more compelling, than protecting the files themselves.
#5
Re: Creating password protected files through java
Posted 05 December 2007 - 04:49 AM
jacob23, on 10 Jan, 2007 - 12:03 AM, said:
Thanks for the reply.
What i want is quite similar to your second point i.e.- I want to encrypt the file (which could be html,pdf,excel or ascii format) with a user saved password;save the file on the application unix server; and then send either the file (if its size is less than 2MB) or a link to the file location to the user in a mail. Now when the user tries to open this file, he should be prompted for a password and only if he enters the correct password should he be allowed to open the file.
I have found java apis which can achieve this for pdf and zip files. I was wondering if similar apis exist for the other formats as well?
What i want is quite similar to your second point i.e.- I want to encrypt the file (which could be html,pdf,excel or ascii format) with a user saved password;save the file on the application unix server; and then send either the file (if its size is less than 2MB) or a link to the file location to the user in a mail. Now when the user tries to open this file, he should be prompted for a password and only if he enters the correct password should he be allowed to open the file.
I have found java apis which can achieve this for pdf and zip files. I was wondering if similar apis exist for the other formats as well?
Hi,i have a similar requirement.
As mentioned by u ,there is some way in core java api
to password protect a zip file..can u please give some light on that..
Thanks in advance..
#6
Re: Creating password protected files through java
Posted 15 February 2008 - 02:17 AM
sss1234jj, on 5 Dec, 2007 - 04:49 AM, said:
jacob23, on 10 Jan, 2007 - 12:03 AM, said:
Thanks for the reply.
What i want is quite similar to your second point i.e.- I want to encrypt the file (which could be html,pdf,excel or ascii format) with a user saved password;save the file on the application unix server; and then send either the file (if its size is less than 2MB) or a link to the file location to the user in a mail. Now when the user tries to open this file, he should be prompted for a password and only if he enters the correct password should he be allowed to open the file.
I have found java apis which can achieve this for pdf and zip files. I was wondering if similar apis exist for the other formats as well?
What i want is quite similar to your second point i.e.- I want to encrypt the file (which could be html,pdf,excel or ascii format) with a user saved password;save the file on the application unix server; and then send either the file (if its size is less than 2MB) or a link to the file location to the user in a mail. Now when the user tries to open this file, he should be prompted for a password and only if he enters the correct password should he be allowed to open the file.
I have found java apis which can achieve this for pdf and zip files. I was wondering if similar apis exist for the other formats as well?
Hi,i have a similar requirement.
As mentioned by u ,there is some way in core java api
to password protect a zip file..can u please give some light on that..
Thanks in advance..
Hi,
I am looking for the similar solution, only difference is i will send those pdf by email. when user will try to open it , he has to enter the correct password.
I want to do it with java API, please guide me how can i do it. I have the code for zipping but not for passwrod protection.
Kindly help
#7
Re: Creating password protected files through java
Posted 16 April 2009 - 09:03 PM
Did you get a solution for workbook protection using Java API?
#8 Guest_Techfunda248*
Re: Creating password protected files through java
Posted 10 February 2010 - 10:43 PM
I Guess iText (http://itextpdf.com/) can be solution to it, but we might have to digg into a bit.
#9
Re: Creating password protected files through java
Posted 10 February 2010 - 10:47 PM
@techfunda248: We appreciate your willingness to help. However, I think you're a day (or a couple of years to be more specific) late, as this thread was started in 2007 and has long since been dead. :)
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote







|