Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Encrypt web files!

by nofernandes (Beadle)
on Jul 24, 2003 at 10:24 UTC ( [id://277494]=perlquestion: print w/replies, xml ) Need Help??

nofernandes has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Encrypt web files!
by ctilmes (Vicar) on Jul 24, 2003 at 10:34 UTC
    If you want to download an HTML page to a user, have their browser display it, but not be able to read the HTML, then no, that is not possible. The browser needs to read the HTML to interpret and display it, so if it is encrypted, it kind of defeats the purpose.

    The only way you could do something like that would be to develop your own custom display plug-in that could decrypt/display the page. Frankly, any decryption that takes place on the end-user's host is subject to reverse engineering anyway, so I would recommend you don't even bother.

Re: Encrypt web files!
by Abigail-II (Bishop) on Jul 24, 2003 at 10:39 UTC
    1. This is not a Perl issue.
    2. What do you have to hide? What's so secret?
    3. Think about it, if the HTML was encrypted, how would a browser display it?

    Abigail

Re: Encrypt web files!
by dbwiz (Curate) on Jul 24, 2003 at 10:36 UTC

    What you are asking is unfeasible, due to the client server protocol in web interface. For the browser to display the page, the server must send it in readable mode, anyway in a format understandable for a browser.

    Everything the web server sends in such format can be read by any program that knows what to expect from a server. You can fool a dumb browser, but nothing can prevent somebody with Perl and LWP from seeing what the server is sending.

    See also html tag encryptor/decryptor for a discussion on the same subject.

Re: Encrypt web files!
by valdez (Monsignor) on Jul 24, 2003 at 10:46 UTC

    It is possible, you must create a new kind of browser, that doesn't allow operations like cut'n'paste, save and print. That browser should also be the only allowed to communicate with your web server... It doesn't seem a practical approach, does it? A solution based on some javascript trick will not stop smart users; the only feasible, but far from good solution is to use Flash everywhere... but a pencil and a sheet of paper will still work :)

    Can you explain us why you need to protect content of your pages? Can't you use a different approach?

    Ciao, Valerio

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Encrypt web files!
by chunlou (Curate) on Jul 24, 2003 at 10:50 UTC

    Once the page on the client-side the browser, it's not Perl's problem. It's HTML and JavaScript problem.

    You can use JavaScript to disable right click, which's breakable, however. In IE, I think it is:

    function click(){ if (event.button==2){ alert("Oops, you can't do that."); return false; } }

    The code is different in Netscape.

    You could also hide your HTML in a JavaScript file, so when view source people will see the links to the javascript files, not the content.


    ________________
    Update: Should have mentioned the consensus that there're no solutions to the problem, only deterrent.

      In the first solution, a knowledgeable user can turn off javascript to get around the "fix".

      --Bob Niederman, http://bob-n.com
        A 'knowledgable user'?? I wish I could have some of those..

      For the second solution, it just adds another layer of indirection. That extra JavaScript page must be publically viewable, and anyone smart enough to look at the source should be smart enough to copy-and-paste the link.

      ----
      I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
      -- Schemer

      Note: All code is untested, unless otherwise stated

Re: Encrypt web files!
by nofernandes (Beadle) on Jul 24, 2003 at 14:16 UTC

    Inspite of this post drag many negative points to my small reputation i thank you all for your advices and for making me understand that this is not the best way!!

    Thank you all!

    Nuno
Re: Encrypt web files!
by ajdelore (Pilgrim) on Jul 24, 2003 at 15:56 UTC

    You might also want to consider that people without javascript (like me) see a blank window when they access your page. I don't know what to what end you are trying to do this, but keep in mind that at least some of the people who visit your site will see nothing at all.

    </ajdelore>

Re: Encrypt web files! (Netscape Navigator v3 ;^)
by ybiC (Prior) on Jul 24, 2003 at 16:42 UTC
    If you distribute your html documents with Netscape Navigator v3 as their viewer, you'll achieve some of what you're looking for, as it allowed right-click to view source but not in a copy+pastable manner.   </tongue_in_cheek>
      cheers,
      ybiC

      striving toward Perl Adept
      (it's pronounced "why-bick")

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://277494]
Approved by Skeeve
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2024-04-19 13:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found