aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes java encryption Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "java encryption" Watch "java encryption" New topic
Author

java encryption

great veera
Greenhorn

Joined: May 14, 2001
Posts: 24
Hi
can anyone pl give me an idea for encrypting a file in java,
Patrick O'Hara
Greenhorn

Joined: May 08, 2001
Posts: 9
You need the Java Cryptography Extension (JCE). There is an implementation of JCE called Cryptix which you can find (http://www.cryptix.org/products/index.html).
There are many schemes to choose from.
There is a pretty good introduction to cryptography here (http://www.ssh.fi/tech/crypto/intro.html).
Hope that helps.

------------------
Pat O
pdohara@techneex.com


Pat O<br />pdohara@practicalprogrammer.org
Fredrik Safstrom
Greenhorn

Joined: May 15, 2001
Posts: 20
Are you looking for real encryption with keys etc. or just a quick and easy way to encrypt messages???
I have a small class that will let you encrypt text messages (doesnt work on binary files), let me know if you are interested...
/Bamse
Ramamoorthy
Greenhorn

Joined: Mar 13, 2001
Posts: 19
Originally posted by Fredrik Safstrom:
Are you looking for real encryption with keys etc. or just a quick and easy way to encrypt messages???
I have a small class that will let you encrypt text messages (doesnt work on binary files), let me know if you are interested...
/Bamse

Dear bamse,
I am interested to know from you the encryption of user inputs.
For example i am getting two fields from the user namely
username and password and i want to send both to the server in encrypted form...so that the same can be decrypted at the server end and compared with the database.
Kindly advise me,if you have solution for that.
If your solution is similar to above ,kindly send me your application,which will be of very much helpful to me.
Regards,
Rama moorthy
Please send your reply to ramamoorthy90@hotmail.com
Fredrik Safstrom
Greenhorn

Joined: May 15, 2001
Posts: 20
Rama,
Here is the class itself:

It's quite simple to use, here is one example;

You can supply the constructor with a code-key if you want, otherwise the codekey will default to 'Q'.
If you want to add upp characters that are specific for your language in the alphabeth string, my version have some Swedish characters in there. The class will only encrypt/decrypt characters in the alphabeth string, if a character cannot be found, it will be ignored and left as is...
Have fun.
/Bamse
John Wetherbie
Rancher

Joined: Apr 05, 2000
Posts: 1449
Ramamoorthy,
Please review the JavaRanch naming policy and consider re-registering. If your username doesn't follow the policy (first name and last name with a space between them) you could be disqualified from the book giveaways.
Thanks,
John


The only reason for time is so that everything doesn't happen all at once.
- Buckaroo Banzai
Rama moorthy
Greenhorn

Joined: May 18, 2001
Posts: 8
Dear Fredrik,
Thanks for your coding..It works fine in a stand alone environment.
But can u guide me how to do the same in a real environment.
In my case,i am getting input from the customer in html page.
Once i submit the form it will call the jsp page residing in server.Before it goes to server the user inputs to be encrypted and then sent.
Kindly clarify and advise me how to proceed further.

Kind regards,
N.Rama moorthy
Originally posted by Fredrik Safstrom:
[B]Rama,
Here is the class itself:

It's quite simple to use, here is one example;

You can supply the constructor with a code-key if you want, otherwise the codekey will default to 'Q'.
If you want to add upp characters that are specific for your language in the alphabeth string, my version have some Swedish characters in there. The class will only encrypt/decrypt characters in the alphabeth string, if a character cannot be found, it will be ignored and left as is...
Have fun.
/Bamse[/B]

Fredrik Safstrom
Greenhorn

Joined: May 15, 2001
Posts: 20
Rama,
I haven't used this code in JSP, I guess you can use it in a bean that your JSP page calls.
Here is a "Live" example from an application that store the user and password in an Object called nos.

Later in the program I use the following to encrypt/decrypt the password from a password field.
To Encrypt:

And to Decrypt:

I then serialize the nos Object into a file to save my options to my hard drive.
Hope this helps, I'm sorry to say that I cannot help you with JSP.
/Bamse
Sarada Bhasker
Ranch Hand

Joined: Sep 11, 2000
Posts: 94
Hi Fredrik,
Your encryption code is fantastic. I am breaking my head to find out what logic you have used for encryption. I found one thing in the process, it doesn't take tab character. i was thinking of using it for storing complete client info. Is there any way you can incorporate that as well.
Thanks
Sarada
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java encryption