• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

DB Encryption/Decryption Techqnique

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...........



 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic