File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 60810
    
  65

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: 41178
    
  45
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.


Ping & DNS - my free Android networking tools app
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: 41178
    
  45
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
 
Similar Threads
Encryption at Application Layer
Properties File
Can a webservice encrypt a file and return it?
creating login table for webapplication
security filter not working on first page