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.

In reply to Execute Perl code on CGI submit for credit card encryption by Popcorn Dave

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.