Re: Enabling tls negotiation in a socket

From: Date: Fri, 09 Jan 2009 13:54:23 +0000
Subject: Re: Enabling tls negotiation in a socket
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-285823@lists.php.net to get a copy of this message
Jehan Pagès wrote:
Hi, I have a question about opening a normal socket, then negotiating a TLS layer in PHP (through another protocol, which is XMPP in my case, in plain text at the beginning). I am currently using a socket created by "socket_create ()". But there seems not to be any way of switching to TLS negotiation with this, is there?
first off; great to see somebody else using XMPP with php :D (there's a great xmpp lib for AS3 from ignite realitime that makes openfire) but no nice ones for php yet as far as I know - was always one of those projects I really wanted to do but couldn't justify without getting a client to part fund :p
Then I see the stream_socket_client () which can then switch to TLS with stream_socket_enable_crypto (). But this is only above PHP 5.1.0. Can anyone confirm me this is the right solution, and also only solution? (I mean "already made" one, I am not going to implement TLS myself! :p)
IMHO this is the best way; using sockets gives you far more control which you'll be needing later. you can also simply stream_socket_client("tls://whatever.com:6548", .... see: http://uk3.php.net/manual/en/transports.inet.php for all available transports
How would you do such a thing otherwise? And is it possible to use stream_socket_enable_crypto () on the socket created by socket_create?
surely socket_create is the other way around (ie opens a server socket not a client connection)? are you trying to create an XMPP server in php? :o
Thanks all. Jehan


« previous php.general (#285823) next »