Re: Enabling tls negotiation in a socket

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux