Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java encryption of String to alphanumeric values

 
Ananth Chellathurai
Ranch Hand
Posts: 349
Eclipse IDE Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,

How do I encrypt a String which is URL compliant. All my trials gives encrypted values with characters like "+" and "\". I could not get the exact values through get parameter values. So when I tried to decrypt I do not get the expected results.


Any sample code or suggestion would be greatly appreciated.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's what URL-encoding does. Check out the java.net.URLEncoder and URLDecoder classes.
 
Ananth Chellathurai
Ranch Hand
Posts: 349
Eclipse IDE Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks ulf,

org.apache.commons.httpclient.util.URIUtil also can fulfill the same requirements.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would you use a 3rd party library if a built-in JRE class can do it?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic