chivigon Posted May 17, 2004 Posted May 17, 2004 I'm also having some issues with GPG Credit Card Encryption (http://www.oscommerce.com/community/contributions,611) contribution. The last post on that contribution doesn't have the ccgpg.php that goes into the includes/languages/english/modules/payment. I found the file in v.93. I deleted the cc.php module, thus I only have the gpg.php module to deal with it. I installed the gpg.php files in their respective locations includes/modules/payment and includes/languages/english/modules/payment. Changed the paths so they point to the location of my temp file, encryption key, and pgp. I created the public and private keys on the Cpanel and imported them into my WinPT. My .gnupg folder and files inside of it have full persmissions while testing. But when I run transactions only receive blank emails with a subject line of "Extra Order Info encrypt a". I followed the sugestions in the GPG_CPanel_setup and commented the lines unlink($plainTxt); and unlink($crypted); therefore I can see the credit cards being written to my temp file. I just can't figure out how to make them come across encrypted. I appreciate any advise on this issue. Here's the code where I set the paths to the gpg.php script. function after_process() { global $HTTP_POST_VARS, $insert_id; if ( (defined('MODULE_PAYMENT_CCGPG_ENCRYPT')) && (MODULE_PAYMENT_CCGPG_ENCRYPT == 'GPG') ) { $message = 'Order #' . $insert_id . "\n\n" . 'Number: ' . $this->cc_complete . "\n\n"; $tmpToken = md5(uniqid(rand())); $plainTxt = "/home/username/temp/" . "$tmpToken" . "anca"; $crypted = "/home/username/temp/" . "$tmpToken" . "anca.asc"; $gpghome="/home/username"; ///temp /.gnupg where is your pubring? That dir has to have write access. $gpgpath="/usr/bin/gpg"; //where is the executable $gpgrecipient="info (info) <[email protected]>"; //the key used for encryption $fp = fopen($plainTxt, "a+"); fputs($fp, $message); fclose($fp); system("export HOME=".$gpghome.";".$gpgpath." --verbose --verbose -r '".$gpgrecipient."' --encrypt -a -z 0 ".$plainTxt." "); $fd = fopen($crypted, "r"); $message = fread($fd, filesize($crypted)); fclose($fd); unlink($plainTxt); tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, 'Extra Order Info encrypt a' , $message, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, ''); unlink($crypted); Quote
strced Posted May 21, 2004 Posted May 21, 2004 I also had quite a few problems getting the encryption to work. I had to change the command being executed slightly and added an output file that holds the errors of the gpg command so I could troubleshoot as I went. The command I used was....... system("export HOME=".$gpghome.";".$gpgpath." --armor --output " .$crypted." -r " .$gpgrecipient. " --encrypt " .$plainTxt. " 2>/home/xxxxx/temp/CryptError.txt"); I got it to work, but I am still not comfortable with the permission I have set on some of the file....still working on that. Good Luck Quote
chivigon Posted May 21, 2004 Author Posted May 21, 2004 Thanks for the tip. I'll try it tonight. Quote
chivigon Posted May 22, 2004 Author Posted May 22, 2004 I got an error log! THANKS SO MUCH Strced for the tip. I found out that the key cannot be found. This is the error log: gpg: Warning: unsafe ownership on file "/home/bakerspl/.gnupg/options" gpg: Warning: using insecure memory! gpg: please see http://www.gnupg.org/faq.html for more information gpg: Warning: unsafe ownership on file "/home/username/.gnupg/random_seed" gpg: Warning: unsafe ownership on file "/home/usermname/.gnupg/secring.gpg" gpg: Warning: unsafe ownership on file "/home/username/.gnupg/pubring.gpg" gpg: [email protected]: skipped: public key not found gpg: /home/username/temp/bf51792078c245cbea2e8c253e0a619aanca: encryption failed: public key not found A member at the OSCdocx (http://oscdox.com/index.php) helped me narrow down the problem. Here's the thread of that post http://oscdox.com/index.php?name=PNphpBB2&...der=asc&start=0. Since the key wasn't been found by the script he suggested the following: "what you can do is execute that gpg commandline in the shell, eg; $gpgpath --homedir $gpghome --verbose --verbose -r $gpgrecipient --encrypt -a -z 0 $plainTxt replace the above strings (everything that's $xxx) with your actual paths and filenames, something like; /usr/bin/gpg --homedir /home/username --verbose --verbose -r [email protected] --encrypt -a -z 0 somefile.txt it should create a somefile.txt.asc if that fails with can't find key, try /usr/bin/gpg --homedir /home/username/.gnupg --verbose --verbose -r [email protected] --encrypt -a -z 0 somefile.txt " The second command worked. I learned there were subkeys used by GPG that I wasn't aware of, thus took me a while to figure out how they worked. I ended up generating my keys through the shell and not the CPanel. Now I can encrypt/send/decrypt. I have to iron a couple of wrinkles and then the shop is ready. I'm trying to figure out how to send expiration dates along with the cc and how to decrypt inside of the email client. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.