I need to encrypt the data in a mysql database so that:

  1. PHP encrypts it
  2. PHp decrypts it
  3. Delphi on windows encrypts it
  4. Delphi on windows decrypts it

and I need the two to be able to work together and understand the data!

I think this may be difficult (understatement?) can anyone help me?

The reason for this is that we want to bring the data from mysql from an internet server to a local client machine, work on it, and then load it back up. To do that we currently use Zeos components in Delphi which effectively connect to the mysql server and do some SQL to bring the data down.

We cannot afford financially to use SSH or VPN, since this requires a dedicated server. SSL doesn't work because we're not on html pages.

    About your only option is to use the mcrypt library with PHP and find or write Delphi source or a pre-written DLL (maybe a Win32 mcrypt DLL) that encrypts and decrypts using the same algorithm and cipher mode on both platforms.

    Here's a PHP mcrypt example.
    http://www.kfu.com/~nsayer/encryption/software/webcrypt.phps

    You can get mcrypt from here.
    ftp://mcrypt.hellug.gr/pub/mcrypt/libmcrypt/

      Do you know of any such dll? I'd need the decrypt at the other end

      Thanks again

      Elizabeth

        The Win32 library at the mcrypt site isn't considered production quality so I don't know if you want to use that. Go to google.com and search for delphi encryption library or delphi encryption source to find something that might be useful.

          Thanks - I'll do that.

          I'm certainly making progress and will let you know the result!

            Write a Reply...