Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

CC# GPG Encryption module


Rodland

Recommended Posts

I've been working on this module for 3 days now and just can't get it to work.

 

I've set it up properly as far as the php files and admin section is concerned, and the order is coming through fine. The middle 8 digits at the order pages of admin are XXXXXXXX out.

 

However, although I do get an 'Extra Order Info' email it is completely blank of information.

 

I'm guessing that this has something to do with my paths.

 

These are correct however:

 

$gpgpath="/usr/bin/gpg"; //MY HOSTING COMPANY SET THIS UP AND TOLD ME THIS WAS THE CORRECT PATH

$gpgrecipient="My Name (CC Details) <[email protected]>"; //I KNOW THIS IS CORRECT!

 

However, I must be having problems with the other paths:

 

$plainTxt = "/home/tmp/" . "$tmpToken" . "anca";

$crypted = "/home/tmp/" . "$tmpToken" . "anca.asc";

$gpghome="/home/"; //where is your pubring? That dir has to have write access.

 

Now my hosting company has created a home directory for me before the httpdocs directory where my catalog pages is stored. This is actually:

 

/home/httpd/vhosts/mydomain.com/home/

/home/httpd/vhosts/mydomain.com/home/tmp/

 

the catalog is stored here:

 

/home/httpd/vhosts/mydomain.com/httpdocs/

 

My public ring is called pubring.gpg

 

I've tried this:

 

$plainTxt = "/home/httpd/vhosts/mydomain.com/home/tmp/" . "$tmpToken" . "anca";

$crypted = "/home/httpd/vhosts/mydomain.com/home/tmp/" . "$tmpToken" . "anca.asc";

$gpghome="/home/httpd/vhosts/mydomain.com/home/"; //where is your pubring? That dir has to have write access.

 

this:

 

$gpghome="/home/httpd/vhosts/mydomain.com/home/pubring.gpg"; //where is your pubring? That dir has to have write access.

 

this:

 

$plainTxt = "/home/tmp/" . "$tmpToken" . "anca";

$crypted = "/home/tmp/" . "$tmpToken" . "anca.asc";

$gpghome="/home/"; //where is your pubring? That dir has to have write access.

 

and the above with this:

 

$gpghome="/home/pubring.gpg"; //where is your pubring? That dir has to have write access.

 

And even, by putting my public key in a directory within the httpdocs directory itself:

 

$plainTxt = "http://www.mydomain.com/home/tmp/" . "$tmpToken" . "anca";

$crypted = "http://www.mydomain.com/ home/tmp/" . "$tmpToken" . "anca.asc";

$gpghome="http://www.mydomain.com/home/"; //where is your pubring? That dir has to have write access.

 

 

Still doesn't work. I just get an Extra Info Email with nothing in it.

 

So I have tried changing the permissions of the directory and files:

 

/home/ (user read, write, execute / group read, execute / world read, execute

 

/tmp/ (user + group read, write, execute / world read, write

 

pubring.gpg (user read, write / other read / world read )

 

to user/group/world read, write, executive

 

 

Do you know what the problem might be? I'm using ms1 ?

 

Is there a way to test these paths by email or something to see if the encryption works?

 

Any help and I would appreciate it big time.

 

Christian

Link to comment
Share on other sites

The simplest way to test this is to use gpg at a command prompt. Have you tried asking your hosting company to do this for you?

 

You can improve the current testing (with the shop) by removing (or better, commenting out) the unlink lines in the function:

         unlink($plainTxt); 

        unlink($crypted);

This will leave the temp files there. If no temp files are created (I'm assuming that you can view this area with FTP or something), then you can focus on that, which is definitely the kind of thing that your host should help you diagnose. You can delete the files manually until you can work things out and restore the unlink lines.

 

For debugging, I would also change the $gpgrecipient to just your email address, without the your name part, i.e.

$gpgrecipient='[email protected]';

Hth,

Matt

Link to comment
Share on other sites

Well I did what you said and NO temp files where left in the temp directory.

 

What does this mean?

 

Also changed the $gpgrecipient details.

 

Might it have something to do with key compatibility? On my personal computer where I created the private and public keys there is a gpg preferences window in which CUSTOM compatibility is selected, though I could select

 

PGP 2.x (rfc 1991)

PGP 2.x (mit pgp 2.6.1)

PGP 6

Open PGP (RFC 2440)

 

There is also a checkbox for PGP 5.x compatible signitures?

 

Really doubt this has anything to do with it though!

 

CMR

Link to comment
Share on other sites

It's not writing the original email to a file. You've checked every path which it would reasonably be, so I would recommend checking the directory permissions if possible (should be 777 for the temp directory and 666 for the pubring and all parent directories--home, etc.).

 

If that is correct, I would try making a pubring directory in your web space, e.g catalog/pubring and catalog/pubring/temp. This is not really a good long term solution but if you can get it working that way, then you can lean on your host to help you fix their solution.

 

Hth,

Matt

Link to comment
Share on other sites

I've actually tried all this with the permissions with no success. Also have tried putting a directory in my httpdocs with the relevant permissions and put my pubring.gpg file in there. Still no success:

 

I don't have command line access to my server to test it. My host wants to know what EXACTLY what he should do to help. For instance, go to command line ... type blah blah, record the results, then type blah blah, if it says blah blah, do this, if not record the results. .... etc.,

 

He doesn't want to help unless I'm more specific, which I can understand.

 

CMR

Link to comment
Share on other sites

Go back to this:

$plainTxt = "/home/httpd/vhosts/mydomain.com/home/tmp/" . "$tmpToken" . "anca"; 

$crypted = "/home/httpd/vhosts/mydomain.com/home/tmp/" . "$tmpToken" . "anca.asc";

and see if it creates the temp file. After that (if it doesn't work), try putting the images directory as the temp directory and see if it creates the temp file.

 

You can create a script called testgpg.php in your catalog directory with the following information:

<?php

 $fh = fopen("/home/httpd/vhosts/mydomain.com/home/tmp/testfile.gpg", "w+");

if $fh fclose($fh);

?>

Then you can just point direct to that script for testing (http://www.yourdomain.com/catalog/testgpg.php). If that works (all it does is creates a file named testfile.gpg), have your host execute the following command as user apache (su to root and then su to apache) or as whatever user httpd runs as:

su

<enter root password when prompted>

su apache  # or whoever httpd runs as, e.g. apache, http, web, nobody

(export HOME=/home/httpd/vhosts/mydomain.com/home/; gpg --gen-key)

<select DSA and ElGamal, which is probably the default>

<keysize 1024>

<expiry 0, i.e. never--you can always make another key later for actual use; it may not ask this>

<y this is correct--never expire>

<Real name:  your name>

<Email address:  [email protected]>

<Comment:  CC Details>

<Confirm your name (CC Details) <[email protected]>>

<Enter passphrase>

<Confirm passphrase by retyping it>

<type junk to confuse random number generator and make it more random>

<delete junk from command line after it exits>

exit # apache

exit # root

Go back to the original temp directory and try again. Btw, # to end of line is comment and can be left out. Stuff in <> needs to be replaced with appropriate values.

 

Good luck,

Matt

 

P.S. I don't have this module installed on my server, so I'm not actually trying it. I did use the testgpg.php to write a temp file. If this continues to not work, you may need to change something in the php configuration.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...