[REBOL] Reading encrypted pages with REBOL??? Re:
From: chris::double::tab::co::nz at: 2-Oct-2000 9:30
> IIRC the reason is size of SSL protocol - several times of size of
> Core :-)
Using OpenSSL (http://www.openssl.org) it is not too difficult to add
SSL support to an existing sockets package. I added SSL support to my
Lisp Socket package in very few lines . This included using SSL
through a generic proxy. I've also done the same with Dylan, adding
SSL support to the existing Dylan sockets library .
If you can call call/link external libraries to include OpenSSL
(Rebol/Command for example) you could might be able to add the support
yourself in a few hours.
Note that I've only done this on Windows - not other OS's - so it may
be more involved than that.
The basic steps once you've got a socket connected using the standard
OS calls were to use the OpenSSL calls:
method = sslv23_client_method();
ctx = ssl_ctx_new(method);
handle = ssl_new(ctx);
ssl_set_fd( handle, socket_descriptor);
ssl_connect( handle );
Once the above is done you use the ssl_write and ssl_read functions
instead of the OS send and recv functions, passing the 'handle' above,
not the socket descriptor:
ssl_write(handle, buffer, length);
ssl_read(handle, buffer, length);
When closing the socket you first need to do some SSL cleanup:
That's all there is too it. The source to my Lisp version is at my
site if anyone wants to try a REBOL vesion.