• Post Reply Bookmark Topic Watch Topic
  • New Topic

DB Encryption/Decryption Techqnique  RSS feed

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends

Can any body please provide me the sample code for Database Encryption and Decryption?

It would be great help if some helps me out
 
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What, exactly, should this code do? Are you looking for Java code that runs before inserting something in the DB/after getting something out of the DB, or something that runs in the DB?
 
Tuna Jen
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ulf
Thanks for replying.

My Requirement is DB Encryption/Decryption........

I have to write java program which will fetch the data from Database and put in the xml file.same data should be encrypted .same thing will apply for Decryption also.

I think you got clear idea. Please let me know if you have any solutions for this..

Thanks in Advance
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So the data is unencrypted in the DB, but should be encrypted in the XML file? And when it is transferred from the XML file to the DB, it should get decrypted? Is that correct?

If so, it sounds as if it has nothing to do with databases, but is merely about how to encrypt/decrypt data.
 
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How far have you gotten on this problem? Have you studied the javax.crypto package JavaDocs? Searched for code examples using google?


The most important point is that XML is a text format and must contain only legal unicode characters, while the initial result of encryption will be a byte[]. Therefore, your encrypted byte[] must be encoded to legal characters - base64 encoding is typically used.

The Apache commons codec toolkit is an open source for base64 encoding classes.

Bill


 
Tuna Jen
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Brogden

Thanks for your valuable time.

i have implemented javax.crypto,BASE64Decoder and BASE64Encoder.

Now it's working wht i was expecting...........



  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!