aspose file tools*
The moose likes Servlets and the fly likes make encryption filter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "make encryption filter" Watch "make encryption filter" New topic
Author

make encryption filter

James Whillis
Ranch Hand

Joined: Jul 27, 2013
Posts: 35
I need to create simple filter. So I decided to create small simple encryption filter which encrypt user's request.
The problem is I don't understand where it should be decrypted?Encryption should be in doFilter method?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

Everything (excepting any initialization) is done in the doFilter() method.

Encryption is pretty much the poster child for filter examples. A search for servlet encryption filter should bring up many of them.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42929
    
  68
Are you sure that you want to encrypt a user's request in a servlet filter? By the time the request reaches the servlet container (and thus the filter), the request has already traversed the public internet where it is most vulnerable, and the next thing that needs to be done with the request would be to decrypt it, so your web app can actually do something with the data.

Maybe you want to encrypt the response? That would mean a special HTTP client, though, because a web browser would not know what to do with the encrypted response.
James Whillis
Ranch Hand

Joined: Jul 27, 2013
Posts: 35
Ulf Dittmer wrote:Are you sure that you want to encrypt a user's request in a servlet filter? By the time the request reaches the servlet container (and thus the filter), the request has already traversed the public internet where it is most vulnerable, and the next thing that needs to be done with the request would be to decrypt it, so your web app can actually do something with the data.

Maybe you want to encrypt the response? That would mean a special HTTP client, though, because a web browser would not know what to do with the encrypted response.


I just need some filter but I have no idea how to use it in my project. I have nothing to filter.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42929
    
  68
So this is some kind of academic project, decoupled from real use? In that case searching for "example servlet filter" will find many ready-to-use examples with instructions.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: make encryption filter