• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

make encryption filter

 
James Whillis
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64721
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic