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

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

posted May 17, 2001 08:25:00

0

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

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

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

posted May 24, 2001 21:29:00

0

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

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