views:

210

answers:

3

I need to transfer data from a PHP script on my local server to a remote API (also written in PHP) on my hosting server. It is basically a primitive version control system, and I use both HTTP GET and HTTP POST to transfer files and strings.

I would like the connection encrypted, but my (shared) web host tells me I can't use SSL because I can't get a dedicated IP address--and even if I could, I don't want to spend any more money on it.

My question is: Is there a better way to do this?

Some possibilities I have considered are using the mcrypt extension in PHP to encrypt data at one end and decrypt at the other.

I also thought of TLS, which--as I understand--can be used to create a secure connection without certificates?

EDIT: Please see this question as a follow up regarding OpenPGP, GnuPG and transfer using MIME.

+1  A: 

You can create a self signed certificate to use for SSL. There's no reason for you to be paying someone like verisign for a certificate if you are the only one who has to trust the certificate.

You also might want to consider the following. A shared hosting service such as Dreamhost (which is what I use) will cost you $10 a month for hosting, $4 a month for the static IP, and $15 a year (1.25 a month) for a real SSL cert. So that's only about $15 a month for a shared hosting account with a real certificate signed by a real CA. I don't know who you are currently with, or what they are charging you, but if you are in anyway serious about this project, $15 a month isn't that much money to put towards it.

Kibbee
uhm.. his hoster says he can't get a dedicated ip. so also a self signed certificate won't do anything as he probably is on a name based virtual host.
jitter
I don't believe a self signed certificate has to use any specific IP Address. I think that's only required if you want your certificate signed by a CA.
Kibbee
That's not the problem. He is on shared hosting, so there are multiple sites under the same IP. The SSL/TSL handshake happens before the hostname is send to the server. So the server can't possibly know for which domain he should server the certificate. So he can't do it.
jitter
But this discussion is obsolete as his hoster won't allow him to install a certificate anyway.
jitter
Then see my second paragraph about getting a non sucky hosting service.
Kibbee
Non sucky hosting would solve my problem :) but I'm financially challenged at the moment
ejm
+1  A: 

I think you're kind of up the river on this one. With a shared host the most obvious solution is HTTPS but if they won't let you do that you're kind of stuck. Any other options you find are going to require you open a socket and I doubt your shared host will allow that either.

You may want to look into Amazon Web Services. I don't know how much you're paying for hosting but they have virtual servers available for 10 cents per hour ($72 a month roughly). Then you'd be free to do whatever you wanted.

Spencer Ruport
+2  A: 

What is the problem with just using a simple symmetric encryption (for example with the help of mcrypt) or something with a public/private key if you really need the signing and all? Another possible solution could be to use installed system tools and put all your files in a password protected zip file. (php function call "system()")

merkuro
symmetric encryption would be the straight-forward solution. But that's a quesiton of security as he has to save the decryption key on the server somewhere. for a public/private key system i would opt for pgp but i doubt his hoster has it installed or lets him isntall it.
jitter
@jitter I don't see the compromising thing as a problem with encryption, because if one server get hacked, you are doomed in any case. For the pgp part: There are a couple of free libraries out fully written in php (eg. TinyPGP http://www.codeproject.com/KB/HTML/Tiny_PGP.aspx).
merkuro
One more thing: You could limit access to the specific areas on the receiving end to exactly one IP address.
merkuro
This is more the type of solution I'm looking for. Will look into PGP.
ejm
Just a correction about TinyPGP, it is in fact not a PGP or GPG implementation. However, the PEAR package Crypt_GPG looks like it will do the trick.
ejm