File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes encryption servlet filter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "encryption servlet filter" Watch "encryption servlet filter" New topic

encryption servlet filter

peter cooke
Ranch Hand

Joined: Mar 16, 2004
Posts: 317
I am writing a servlet filter that decrypts parameter=value on the way in, and encrypts things on the way out.

I can find lots of things on the internet that say this is what servlet filters are ment to do.

I can get the request parameter/values then encrypt/decrypt the name-value pair.

I am missing how to swap out the old parameter name-value pair for the new parameter name-value pair in the request. I don't want to change my parameters to attributes, because so many other classes depend on getParameter.

Any Suggestions

CIAO Peter M. Cooke
Darren Edwards
Ranch Hand

Joined: Aug 17, 2005
Posts: 69
You are not allowed to set parameters directly, but you can work around this.

Write your own wrapper subclass of HttpServletRequest that overrides the getParameter/s method/s. Your subclassed version can return the encrypted values either on the fly or from a precomputed cache.

I agree. Here's the link:
subject: encryption servlet filter
It's not a secret anymore!