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

Encrypted password containing carraige return character not getting saved in database

 
RAGHAVA KUMAR
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

While iam applying Exclusive-OR on two different strings(encryption),I am getting carraige return character in the resultant string. It is not getting saved properly in the database. Can you please suggest how to identify the carraige return character in the string and replacing with some other character so that it will be saved properly in the database.
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If a String is encrypted it is no longer character data - it becomes binary data. So you can no longer store it in a String, or work on it using String's methods, or store it in a varchar field in a DB.

The easiest solution would probably be to generate an ASCII representation of the data using something like base-64. The Apache Commons Codec library has methods to encode and decode base-64.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic