Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need Fast and Simple Text Encryption

 
ayyappan Bas
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I need to implement text encryption in my program.
Though ive read about encryption before in passing I dont
know much about the different types so I was hoping someone
could help me pick one.
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Java API for encryption/decryption is called "JCE". The http://faq.javaranch.com/java/SecurityFaq has a number of links regarding that, including articles that have sample code for using the DES and AES ciphers in Java.

I'll move this to a more appropriate forum, since it has nothing to do with JSP. Please CarefullyChooseOneForum.
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't use DES for anything new. its OK to use it for legacy compatibility.

If you don't know, just use AES with 128 bit keys
 
shashank shekhar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can also refer to this link for example code:
http://www.idevelopment.info/data/Programming/java/security/java_cryptography_extension/StringEncrypter.java
It shows encryption-decryption for 3 algorithms: Blowfish, DES, Triple DES
 
greg stark
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by shashank shekhar:
You can also refer to this link for example code:
http://www.idevelopment.info/data/Programming/java/security/java_cryptography_extension/StringEncrypter.java
It shows encryption-decryption for 3 algorithms: Blowfish, DES, Triple DES


Don't go to that link! The code there contains atrocious and immoral exception handling, and just serves to poison the thinking of java beginners.
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by greg stark:
Don't go to that link! The code there contains atrocious and immoral exception handling, and just serves to poison the thinking of java beginners.


Listen to Greg. That code is sinful. Especially the encrypt and decrypt routines. Never do it that way.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic