Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

encrypt / decrypt?

by DreamT (Pilgrim)
on Jun 17, 2009 at 12:28 UTC ( [id://772366]=perlquestion: print w/replies, xml ) Need Help??

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

Hi again, I'm working on a simple "ajax framework", and i'd like to encrypt the parameters so that the Ajax call only has one parameter (data=<encrypted string>), instead of the standard 'a=123&b=12345'.
When the script receives the call, it should of course decrypt it.

It doesn't have to be "ultra-safe" (i.e. no "dangerous parameters" are sent), I just want it to look good;-)

How to do it?

Replies are listed 'Best First'.
Re: encrypt / decrypt?
by Corion (Patriarch) on Jun 17, 2009 at 12:32 UTC

    Use CGI::Session. This has the advantage that you don't even need JavaScript.

      Ok, if I understand it right, this module makes it possible to store data "persistent"?

        The "one line description" of CGI::Session says:

        CGI::Session - persistent session data in CGI applications

        That sounds similar to what you described.

Re: encrypt / decrypt?
by dorward (Curate) on Jun 17, 2009 at 13:21 UTC
    Please don't. URIs don't need to look pretty, and adding layers of obfuscation makes development, bug fixing and maintenance harder.
Re: encrypt / decrypt?
by tmaly (Monk) on Jun 17, 2009 at 14:28 UTC

    If you wanted to do the encryption on the client side, you could use dojo http://www.dojotoolkit.org/book/dojo-book-0-9/part-5-dojox/dojox-cryptography

    And then on the server side use a perl module of the same flavor cypher

Re: encrypt / decrypt?
by citromatik (Curate) on Jun 17, 2009 at 12:35 UTC
Re: encrypt / decrypt?
by jettero (Monsignor) on Jun 17, 2009 at 18:27 UTC
    I think corion is right about using CGI::Session... but if you don't want to do that, and you insist on obfuscating the URI, you might consider treating the data as a path and using $cgi->path_info to extract the path past your CGI. (This only works in webservers that support it.)

    -Paul

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-26 04:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found