http://www.perlmonks.org?node_id=488245

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

Fellow monks,

I've Googled and Super Searched this to no avail.

I've got a super small shopping cart I'm doing for work ( 5 items ) and I've got it almost all done but I've come up with a problem I can't solve, and I'm not sure I'm attacking it the right way.

I've set up the web page as a self referencing CGI script using https not plain http, which is all well and good, but when I get to the part to have people enter a credit card number for payment, I'm stuck on exactly when to do the encryption. I'm using Crypt::OpenPGP to do my encryption, but I'd like to do it when the submit button is clicked. I know things like this can be done in JavaScript with an -onSubmit but I'm curious how to do this in Perl - or if it's even possible. Trying to use Crypt::OpenPGP fails at present as there is no data in the form to encrypt, thus my question.

My other thought is: Am I barking up the wrong tree? Do I even need to worry about encrypting a cc number in a https post until it's a parameter on the new page? I can obviously easily encrypt the parameter once it's passed, but my concern is obviously security.

Thanks in advance!

Update: Sorry for being unclear. I wasn't trying to do my encryption in JavaScript, but rather emulate the -onScript function in the submit using Perl code rathe than JavaScript.

Useless trivia: In the 2004 Las Vegas phone book there are approximately 28 pages of ads for massage, but almost 200 for lawyers.