delphi

For a week or so now I have been trying to help out an associate who needs to demonstrate to potential clients that he can deliver certain specified capabilities in a program.

One thing he needs to demonstrate is that he can write a stand-alone program that will connect to a specific secure http server send a message to it, and retrieve a response. This doesn't sound too hard, and indeed it is not, if you are using the right tools. The right tools in this case being an up to date version of the Java software development kit.

Within the same evening of receiving the specifications I was able to write about ten lines of code that connected to the secure server, sent the supplied message (in XML format) and retrieved and uncompressed the response.

This satisfied me that the server was working properly.

I thought it would be a fairly easy matter to duplicate this activity within a Delphi program.

Unfortunately none of the components of Delphi 7 (which I run on my Windows 2000 laptop) support making SSL (secure socket layer) connections. I tried to install a version of CurlLib which is based on that handy Unix utility 'curl' that can retrieve almost any kind of file from any kind of server. Eventually I gave up as I couldn't figure out quite how to compile it all.

Thinking things would be easier if I was using a more up to date version of Delphi, I installed version 2005, running on my mum's new laptop, which is just about fast enough to make it usable. Sure enough it had all kinds of extra web components, but it took some time for me to cotton on that I needed to use the 'Indy' or Internet Direct components. Once I had worked this out it didn't take too long to come up with some code for connecting to a secure server. This worked for just accessing any old secure web site, but failed whenever I tried to connect to the actual server.

Trying to figure what might be wrong lead me down the path of investigating certificates - which are the bits of information that are stored on your machine and the machine you connect to, like ciphers, what let you and someone else communicate without anyone else being able to listen in, or impersonate one of you.

Having finally generated and correctly 'self-signed' my certificate, I found that it made no difference. So, I gave up on Indy and moved onto my final attempt which was a library named 'Synapse'. This was much easier to install, and could work even with Delphi 7. I got it connecting to normal web servers, but unfortunately it failed to connect to any secure servers that I pointed it at.

So finally here I am, having exhausted all obvious avenues to do something that I thought would be simple. So there is nothing left for me to do but sing the blues...


My delphi's not working

It just won't compile

And when I try to connect it

I end up losing my smile



Secure socket layer

Ain't my cup of tea

I made my certificate

And my private key



So now I give up

And call it a day

Can't talk with that server

No how and now way



Now there is a moral

To this sorry tale

Just stick to your Java

Or you're sure to fail!