• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

make encryption filter

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
girl power ... turns out to be about a hundred watts. But they seriuosly don't like being connected to the grid. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic