I'm trying to create a socket server using stream_socket_server().
Normal connections work fine, but I want to make a server that encrypts the connection without a certificate. I know that this can be accomplished with the ADH cipher, and yes, I know it's theoretically less secure than with a certificate...
The reason I'm making this server in the first place is to mock a different server to which a client connects to (over this protocol, if you're wondering).
The client is configured to ask for a certificate first, and fallback to ADH - I've tested it with the real thing, and it connects without problems, so the problem is with the socket server.
Everything I've tried so far has resulted in a "handshake failure" error.
Some of the configurations I've tried:
<?php
$server = stream_socket_server(
"tls://127.0.0.1:6667",
$errorno,
$errstr,
STREAM_SERVER_BIND | STREAM_SERVER_LISTEN,
stream_context_create(
array('ssl' => array('ciphers' => 'ADH'))
)
);
?>
<?php
$server = stream_socket_server(
"tls://127.0.0.1:6667",
$errorno,
$errstr,
STREAM_SERVER_BIND | STREAM_SERVER_LISTEN,
stream_context_create(
array('ssl' => array('ciphers' => '-COMPLEMENTOFALL ADH'))
)
);
?>
I've also tried to adjust the client to unconditionally use ADH (as with the second example above), just for testing's sake, but that too fails.
This happens with every PHP version I've tried, the latest of which is 5.5.0.
Any ideas?