ratcateme Posted March 27, 2008 Share Posted March 27, 2008 Hi i am creating a SSL socket for listening. i have checked Google and Wikipedia and found that i need to send a SSL handshake. this is the most informative site i have found so far http://byerley.cs.waikato.ac.nz/~tonym/articles/ssl/node3.htm at the moment i have this. ssl.php for listening for a connection at the moment it outputs the CLIENTHELLO (I think)??: #!/usr/bin/php <?php $port = 9000; $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP) or die('ERROR 1'); socket_set_option($sock, SOL_SOCKET, SO_REUSEADDR, 1) or die('ERROR 1'); socket_bind($sock, "10.1.1.10", $port) or die('ERROR 1'); socket_listen($sock) or die('ERROR 1'); $clients = array($sock); while (true) { $read = $clients; if (socket_select($read, $write = null, $except = null, 0) < 1) continue; if (in_array($sock, $read)) { $clients[] = $newsock = socket_accept($sock); $key = array_search($sock, $read); unset($read[$key]); $cid = array_search($newsock, $clients); $tracker[$cid]['login'] = false; } foreach ($read as $read_sock) { $cid = array_search($read_sock, $clients); $data = @socket_read($read_sock, 1024, PHP_NORMAL_READ); if ($data === false) { unset($clients[$cid]); continue; } $data = trim($data); if (!empty($data)) { echo $data."\n"; $data=str_split($data); foreach($data as $value){ echo ord($value)." "; } echo "\n-----------------------------------------------------------------------\n"; } } } ?> and sslb.php for connecting to ssl.php it uses tls:// i think i should use tsl:// not ss:// but any ideas welcome? here is the script: #!/usr/bin/php <?php $sock = fsockopen('tls://10.1.1.10',9000); fclose($sock); ?> at the moment i get this output: \XGëPã®Þ2X«w6¶VÏYÜZJ~,[AI0985 22 3 1 0 92 1 0 0 88 3 1 71 235 15 80 227 174 222 50 131 88 171 119 4 54 182 86 207 30 3 89 220 134 90 74 126 44 91 22 65 2 144 73 0 0 48 0 57 0 56 0 53 0 22 0 19 22 3 1 0 92 1 0 0 88 3 1 71 235 16 245 241 25 141 162 80 247 41 162 57 63 113 176 128 34 35 167 234 196 78 242 202 178 110 54 132 80 43 144 0 0 48 0 57 0 56 0 53 0 22 0 19 i don't think the ASCII (top line) means anything, the middle line is the top line converted to ASCII values(I think this is the relevant data). but i am trying to work out how to fit this data into the format of the client hello message at the page mentioned above. the bottom line is a re-run of sslb.php as you can see the end and start are the same i don't know if this helps but i thought i should include it. any ideas on anything would be appreciated. Scott. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.