Hi,

I have loaded the appropriate keys:

//load keys
$ca_file = openssl_x509_read('file://'.$ca_file);
$public_key = openssl_pkey_get_public('file://'.$public_key_file);
$private_key = openssl_pkey_get_private('file://'.$private_key_file);

and can successfully encrypt data:

$to_send = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0
     epp-1.0.xsd">
  <hello/>
</epp>';

openssl_public_encrypt($to_send, $message, $public_key);

I then write the encrypted data to the socket using socket_write (when
communicating with a server) but the server disconnects me when I attempt to
read its output with socket_read:

 Warning: socket_read() unable to read from socket [54]: Connection reset by
peer

Any idea why? To what I understand, I might need to do a SSL handshake
first? How can that be done with PHP?

Thanks a lot!

Pierre-Luc Soucy



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

Reply via email to