File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

String encryption and decryption algorthm for small/medium-sized application

 
Ravi Sree
Ranch Hand
Posts: 64
Java MySQL Database PHP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am working on a module which takes some input from user and encrypts the String before saving to the database,
Now i have a requirement is to decrypt the same string to use it for various processes.

For eg
To generate a unique encrypted String id from the user input.

I tried generating a random int and concatenating the string from user to this int and then encrypting
but then again how can i decrypt the same to the get the value inserted by user at another place for another process.

I know of the Java MD5/SHA Digesters which to do a similar function.
But since this seems to be like no dehashing/decrypting, only half of the requirement is accomplished.

Please suggest a good method to tackle this situation.

Thanks in advance,
Sree

(P.S I haven't tried JCA and didn't get any reading material to start with.)
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
MD5 and SHA are not encryption algorithms but hash algorithms. You can see it as one way encryption. You should look into JCE. I know that some of one will say "duh!" to the following statement but to be sure: please don't invent our own encryption algorithm.
 
Ravi Sree
Ranch Hand
Posts: 64
Java MySQL Database PHP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wouter Oet wrote:MD5 and SHA are not encryption algorithms but hash algorithms. You can see it as one way encryption. You should look into JCE. I know that some of one will say "duh!" to the following statement but to be sure: please don't invent our own encryption algorithm.


Hi Wouter,

Thanks for replying,
I had written JCA for JCE by mistake earlier.
I understand reinventing the wheel is not always the right thing,
But i thought there might be some simple algorithm to come up with,
but couldn't think of a correct but simple way...

Can you suggest any e-books or links for starting with JCE
(will be much obliged if those are with some examples.)

Regards,
Sree
 
Lester Burnham
Rancher
Posts: 1337
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The SecurityFaq has several introductory links regarding JCE including code examples.
 
Ravi Sree
Ranch Hand
Posts: 64
Java MySQL Database PHP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lester Burnham wrote:The SecurityFaq has several introductory links regarding JCE including code examples.


Thanks Lester,
I will check those links right away.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic