• 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
  • Liutauras Vilda
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Peter Rooke
  • Himai Minh
Bartenders:
  • Piet Souris
  • Mikalai Zaikin

Problem encrypting URL with AES

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am successfully encrypting a URL from my client servlet and my serverside servlet handles the request. The code is below.

My problem is that the decrypted URL is not the "id=101&item=22&conf=12234" I am expecting -- in fact, the encrypted part of the URL is changing each time (not what I'd expect because I'm using the same passphrase). I need help understanding AES encryption and possibly an example using a passphrases would be appreciated.

Client servlet code:


Serverside servlet code:
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

You can't use "encrypted.toString()" because encrypted does not consist of characters, but of binary bytes. If you need to transport it as ASCII, use an encoding like base-64 (e.g. from the Jakarta Commons Codec library).
 
reply
    Bookmark Topic Watch Topic
  • New Topic