Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using SealedObject , Encryption & Decryption

 
Sathi Krishna
Ranch Hand
Posts: 51
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am using the below techinique for encrypting and decrypting the passwords.

http://en.allexperts.com/q/Java-1046/2009/3/encryption-decryption-using-java.htm


Based on the requirement what I get, I've to use SealedObject concept for encryption and decryption.

http://www.exampledepot.com/egs/javax.crypto/EncryptObject.html


I've to implement two methods which take String as parameter and String as return value.

public String encrypt(String str) { //new Logic for encrypting using SealedObject }
public String decrypt(String str) { // New logic for decrypting using SealedObject }

Steps
1. Original String
2. Get Encrypted String by invoking encrypt(originalStr)
3. Store the encStr in to DB
4. Read the encStr from DB
5. Get Decrypted(originalStr) by invoking decrypt(encStr)

so how do I save SealedObject as String into DB? is it is possible?

Excuse, if any thing wrong in question.

Looking for help
SvKrishnaReddy
 
sudheer kiran
Ranch Hand
Posts: 237
Firefox Browser MyEclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
our jvm has default encoder and encoder which is simple why dont you use that one

 
Rob Spoor
Sheriff
Pie
Posts: 20527
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because that may disappear or change completely in a next update. Never use classes that are in packages that start with sun, sunw or com.sun as these all may disappear or change as Sun see fit. That is also why these are not in the Javadoc pages.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic