The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> PHP Development
|
PHP-Extension - Using Gnupg to encrypt credit card details
Discuss Using Gnupg to encrypt credit card details in the PHP Development forum on Dev Shed. Using Gnupg to encrypt credit card details PHP Development forum discussing coding practices, tips on PHP, and other PHP-related topics. PHP is an open source scripting language that has taken the web development industry by storm.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

January 3rd, 2013, 06:48 AM
|
|
Registered User
|
|
Join Date: Jan 2013
Posts: 6
Time spent in forums: 1 h 41 m 50 sec
Reputation Power: 0
|
|
|
PHP-Extension - Using Gnupg to encrypt credit card details
I know it is difficult to answer me when the questions to ask is not even simple. I will explain.
I have a provider where I run PHP. My boss needs to store credit card details in the database. But the English law requires them to be encrypted. I want to use gnupg to encrypt the credit card details.
Then I look on php.net and there is a function (among others) called gnupg_init(). This seems to provide all that I want. But when I use it it cannot find the function.
I also read that the gnupg library is available as a PECL. This PECL stuff is all new to me.
I just do not know what to do?
Do I download the library? I think so. But where do I place it?
Do I upload it next to my php programs on the server?
Do I have to change something in the php.ini file?
Can anybody give me an idea as to what I need to do? It is all a big riddle to me now.
Always keep in mind that I want to achieve the following:
- I receive credit card details automatically in my php program. This already works.
- I now store them in the database (already works) but I would like to encrypt them using gnupg before doing that. I know I need a public key from the person that will eventually decrypt it for this.
Not too much to ask I think. Should not be too difficult, but it is.
|

January 3rd, 2013, 07:13 AM
|
|
|
This explains how to download and install PECL extensions.
__________________
There are 10 kinds of people in the world. Those that understand binary and those that don't.
|

January 3rd, 2013, 08:05 AM
|
|
Registered User
|
|
Join Date: Jan 2013
Posts: 6
Time spent in forums: 1 h 41 m 50 sec
Reputation Power: 0
|
|
|
Hmm That might be very obvious for you, but it does not help me. I had already found this.
Can you give me some steps to take.
Do you think it possible what I want?
|

January 3rd, 2013, 08:07 AM
|
|
|
|
Then I don't understand your question. What part of the installation instructions do you not understand? Quote the section and I'll try to explain.
|

January 3rd, 2013, 08:38 AM
|
|
Registered User
|
|
Join Date: Jan 2013
Posts: 6
Time spent in forums: 1 h 41 m 50 sec
Reputation Power: 0
|
|
|
That is the very problem.
I have no clue as to where to start.
I never installed a PECL and I do not know how.
I want to run the gnupg_* functions in PHP.
If I look at phpinfo(), I see no gnupg there.
Does that mean my provider does not offer this?
Or can I install it myself?
I take it that the provider does not like it when several users install this or is this normal behaviour?
Is it this I must run?
$ pecl install {package}
It is all so new to me.
|

January 3rd, 2013, 08:45 AM
|
|
|
|
Start with the section titled "Downloading PECL extensions."
|

January 3rd, 2013, 09:09 AM
|
|
Registered User
|
|
Join Date: Jan 2013
Posts: 6
Time spent in forums: 1 h 41 m 50 sec
Reputation Power: 0
|
|
|
so I do the command line command:
pecl download gnupg
And that is enough?
|

January 3rd, 2013, 09:17 AM
|
|
|
|
If you have the pecl command installed yes. That will download the file then you follow the next steps in the instructions. If you don't have the pecl command installed then install it first. How you install it depends on your OS.
|

January 3rd, 2013, 09:43 AM
|
|
Registered User
|
|
Join Date: Jan 2013
Posts: 6
Time spent in forums: 1 h 41 m 50 sec
Reputation Power: 0
|
|
|
I ran the command on the provider's server but it produced and error. Probably there is no pecl command there.
|

January 3rd, 2013, 09:50 AM
|
|
|
|
If you don't own the server or have admin (sudo) privileges then it won't matter as you will not be able to install software anyway. If that is the case then you need to ask your systems admin to install it for you.
If that is not possible then you are going to have your work cut out for you. You will probably have to install GPG in your own workspace, and program your page to encrypt/decrypt the data as necessary with 'system' calls rather than PHP extensions.
|

January 3rd, 2013, 09:54 AM
|
|
Registered User
|
|
Join Date: Jan 2013
Posts: 6
Time spent in forums: 1 h 41 m 50 sec
Reputation Power: 0
|
|
|
I do not have rights on the server and I figured that was going to be the problem all along. I had hoped there was a PHP class that I could upload in my workspace and run from there.
I think I give up or maybe you have other ideas.
Thanks for you help
Eric from Spain
|

January 3rd, 2013, 10:35 AM
|
|
|
|
As I suggested, you can install GPG in your own workspace and write the pages using 'system' to encrypt/decrypt the data.
|

January 3rd, 2013, 06:58 PM
|
 |
Lost in code
|
|
|
|
|
The mcrypt extension is a better way of doing this. There's a good chance that it is already installed on your host, but if it isn't, you won't be able to install it yourself.
There is a pure-PHP library called phpseclib that can perform RSA encryption. It will be slow, but you can use that as a fall back if mcrypt is not available.
|

January 4th, 2013, 03:01 AM
|
|
Registered User
|
|
Join Date: Jan 2013
Posts: 7
Time spent in forums: 1 h 2 m 52 sec
Reputation Power: 0
|
|
|
mcrypt...openssl
GnuPG is a fine product but for this, you may be better off using the PHP OpenSSL functions if you would like to do RSA encryption.
If you are looking for a solution for symmetrical encryption mcrypt would fit the bill.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|