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 of jsp file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Encryption of jsp file" Watch "Encryption of jsp file" New topic

Encryption of jsp file

sandeep kokane

Joined: Nov 29, 2000
Posts: 19
We developed one application in jsp.
We are going to give this application (with jsp files and tomcat server) to our client.
We want to encrypt the source files (jps). Is it possible ??? Or is there any alternative to hide my jsp code from my client...
Need urgent Help...
Thanks in advance.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
Since a JSP has to be readable by the JSP to Java convertet, you can't encrypt it. Why not take the converted Java source code and rename it as a servlet?
Andre Moo

Joined: Sep 29, 2001
Posts: 22
Yes, that is a workable solution. As long as you know where your container stores the translated JSP's this is a snap. Also, you obviously don't need to do this for all the JSP's just the ones with sensitive information or IP.
Another approach which would not work in your case unless you wanted to start all over again, is to write a custom tag that lets you "include" encrypted jsp's. You would obviously take a performance hit at runtime though. Next time.
Yet another approach is to make your JSP's "difficult" to read without alot of effort by making them un-abridged i.e remove white space so that the contents of the whole JSP basically ends up on one line! Its not pretty and I'm not sure if this would actually work with JSP's but it works with other things e.g Javascript files, HTML files etc. and I see no reason why it would work with JSP's. Also the file size becomes smaller but this doesn't matter with JSP's.
I agree. Here's the link:
subject: Encryption of jsp file
It's not a secret anymore!