<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
Buenos días, </div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
Estoy intentando utilizar su librería nopoll para realizar una conexión websocket en C, hasta el momento no consigo establecer una conexión, en el handshake siempre me rechaza la conexión. </div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
A continuación les indico como intento realizar la conexión por si pudieran ayudarme.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
Establezco opciones: </div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof ContentPasted1 ContentPasted3">
opts = nopoll_conn_opts_new ();<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof ContentPasted1">
nopoll_conn_opts_set_extra_headers establezco usuario y contraseña (Authorization: Basic) y el X-Txn-Token necesarios.</div>
<div class="elementToProof">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="ContentPasted4">
nopoll_conn_opts_set_ssl_protocol (opts, NOPOLL_METHOD_TLSV1_2);<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="ContentPasted4">
<br>
</div>
<div id="Signature">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<div style="margin: 0px 0cm; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; text-align: start; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);">
<b><span data-ogsc="navy" style="font-size:9pt;font-family:Verdana, sans-serif;margin:0px;color:navy !important" class="ContentPasted0"></span></b>nopoll_conn_opts_set_ssl_certs (opts,
<div>                              // certificate </div>
<div>                              "client.pem",</div>
<div>                              // private key </div>
<div>                              "client.pem",</div>
<div>                              NULL,</div>
<div>                              // ca certificate </div>
                              "root.pem");<br>
</div>
<div style="margin: 0px 0cm; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; text-align: start; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);">
<br>
</div>
<div style="margin: 0px 0cm; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; text-align: start; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);">
Los certificados client.pem son los que nos ha proporcionado el servidor, el root.pem me he basado en sus ejemplos nopoll de TLS.</div>
<div style="margin: 0px 0cm; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; text-align: start; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);">
<br>
</div>
<div style="margin: 0px 0cm; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; text-align: start; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);">
Establezco el contexto </div>
<div style="margin: 0px 0cm; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; text-align: start; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);">
<br>
</div>
<div style="margin: 0px 0cm; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; text-align: start; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);" class="ContentPasted5">
nopoll_ctx_set_ssl_context_creator (ctx, ryd_ssl_context_creator, NULL);<br>
</div>
<div style="margin: 0px 0cm; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; text-align: start; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);" class="ContentPasted5">
<br>
</div>
<div style="margin: 0px 0cm; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; text-align: start; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);" class="ContentPasted6">
SSL_CTX *ryd_ssl_context_creator (noPollCtx * ctx, noPollConn * conn, noPollConnOpts * opts, nopoll_bool is_client, noPollPtr user_data)
<div class="ContentPasted6">{</div>
<div class="ContentPasted6">      return SSL_CTX_new (is_client ? TLSv1_2_client_method () : TLSv1_2_server_method ()); </div>
}<br>
</div>
<p style="margin: 0cm; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; text-align: start; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);">
<br>
</p>
<p style="margin: 0cm; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; text-align: start; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);">
E intento la conexión TLS</p>
<p style="margin: 0cm; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; text-align: start; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);">
<br>
</p>
<p style="margin: 0cm; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; text-align: start; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);">
donde <span style="background-color:rgb(255, 255, 255);display:inline !important" class="ContentPasted7">aux_port, <span style="background-color:rgb(255, 255, 255);display:inline !important" class="ContentPasted8">url_pm son el puerto 443 y el hostname y <span style="background-color:rgb(255, 255, 255);display:inline !important" class="ContentPasted9">aux_conn2
 es https://hostname</span></span></span></p>
<p style="margin: 0cm; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; text-align: start; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);">
<br>
</p>
<div style="margin: 0px 0cm; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; text-align: start; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);">
conn = nopoll_conn_tls_new (ctx, opts, "185.201.145.235", aux_port, url_pm, "/ryd", NULL, aux_conn2);<br>
</div>
<p style="margin: 0cm; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; text-align: start; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);">
<br>
</p>
<p style="margin: 0cm; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; text-align: start; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);">
Debugueando en su librería en linux siempre sale por este error : </p>
<p style="margin: 0cm; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; text-align: start; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);">
<br>
</p>
<div style="margin: 0px 0cm; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; text-align: start; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);">
nopoll_log (ctx, NOPOLL_LEVEL_CRITICAL, "syscall error while doing TLS handshake, ssl error (code:%d), conn-id: %d (%p), errno: %d, session: %d",<br>
</div>
<div style="margin: 0px 0cm; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; text-align: start; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);">
<br>
</div>
<div style="margin: 0px 0cm; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; text-align: start; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);">
Y en windows esto es lo que veo con wireshark </div>
<div style="margin: 0px 0cm; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; text-align: start; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);">
<br>
</div>
<div style="margin: 0px 0cm; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; text-align: start; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);">
<img style="max-width:100%" class="ContentPasted10 w-1799 h-534" size="102426" contenttype="image/png" data-outlook-trace="F:1|T:1" src="cid:ed135da4-f14a-4209-8c83-6cb6639885af"><br>
</div>
<p style="margin: 0cm; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; text-align: start; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);">
<br>
</p>
<p style="margin: 0cm; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; text-align: start; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);">
Se intenta el handshake pero no parece que solicite los certificados y devuelve error.</p>
<p style="margin: 0cm; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; text-align: start; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);">
<br>
</p>
<p style="margin: 0cm; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; text-align: start; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);">
Muchas gracias y un saludo.</p>
<p style="margin: 0cm; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; text-align: start; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);">
<br>
</p>
</div>
<p style="font-family:"Times New Roman";font-size:medium" class="ContentPasted2">
 </p>
<table style="vertical-align:-webkit-baseline-middle;font-family:Arial;max-height:159px;width:405px;max-width:405px">
<tbody>
<tr>
<td style="vertical-align:top;text-align:left;height:83px"><a href="https://www.avaloninformatica.com/"><img width="106" style="max-width:106px;display:block" class="ContentPasted2" src="https://avaloninformatica.com/email-signature/Avalon.gif"></a></td>
</tr>
<tr>
<td style="vertical-align:bottom;width:403px">
<h3 color="#13294B" style="margin:0px;font-size:12pt;line-height:24pt;color:rgb(19, 41, 75)">
<span class="ContentPasted2">Javier Mora Alonso</span></h3>
<p color="#13294B" style="margin:0px;color:rgb(44, 86, 151);font-size:11pt;line-height:14pt;font-style:italic">
<span class="ContentPasted2">Analista / Programador</span></p>
<p color="#13294B" style="margin:0px;color:rgb(44, 86, 151);font-size:11pt;line-height:14pt">
<span class="ContentPasted2">Desarrollo</span></p>
</td>
</tr>
<tr>
<td height="3" style="width:404.987px;border-bottom:1px solid rgb(19, 41, 75);border-left:none;display:block" class="ContentPasted2">
 </td>
</tr>
<tr>
<td class="ContentPasted2"> </td>
</tr>
<tr>
<td colspan="3">
<table style="vertical-align:-webkit-baseline-middle;width:404.987px" id="tableSelected0">
<tbody>
<tr style="vertical-align:middle">
<td width="25" height="25" style="vertical-align:middle"><img width="16" style="display:block" class="ContentPasted2" src="https://avaloninformatica.com/email-signature/phone-icon.png"></td>
<td height="25" style="color:rgb(19, 41, 75);vertical-align:middle"><a href="tel:+34916347750" color="#13294B" style="font-size:9pt;color:rgb(19, 41, 75) !important" class="ContentPasted2"><span style="color: rgb(19, 41, 75);">+34 916 347 750</span></a></td>
</tr>
<tr style="vertical-align:middle">
<td width="25" height="25" style="vertical-align:middle"><img width="16" style="display:block" class="ContentPasted2" src="https://avaloninformatica.com/email-signature/email-icon.png"></td>
<td height="25" style="color:rgb(19, 41, 75);vertical-align:middle"><span style="font-size: 9pt; background-color: rgb(255, 255, 255); color: rgb(19, 41, 75);"><a href="mailto:jmora@avaloninformatica.com" title="mailto:jmora@avaloninformatica.com"><span style="color: rgb(19, 41, 75);">jmora@avaloninformatica.com</span></a><a href="mailto:info@avaloninformatica.com" color="#13294B" class="ContentPasted2"></a></span></td>
</tr>
<tr style="vertical-align:middle">
<td width="25" height="25" style="vertical-align:middle"><img width="16" style="display:block" class="ContentPasted2" src="https://avaloninformatica.com/email-signature/link-icon.png"></td>
<td height="25" style="color:rgb(19, 41, 75);vertical-align:middle"><a href="https://avaloninformatica.com/" color="#13294B" style="font-size:9pt" class="ContentPasted2"><span style="color: rgb(19, 41, 75);">www.avaloninformatica.com</span></a></td>
</tr>
<tr style="vertical-align:middle">
<td width="25" height="25" style="vertical-align:middle"><img width="16" style="display:block" class="ContentPasted2" src="https://avaloninformatica.com/email-signature/linkedin.png"></td>
<td height="25" style="color:rgb(19, 41, 75);vertical-align:middle"><a href="https://www.linkedin.com/company/avalon-informatica-y-servicios-slu/" color="#13294B" style="font-size:9pt" class="ContentPasted2"><span style="color: rgb(19, 41, 75);">LinkedIN</span></a></td>
</tr>
<tr style="vertical-align:middle">
<td width="25" height="25" style="vertical-align:middle"><img width="16" style="display:block" class="ContentPasted2" src="https://avaloninformatica.com/email-signature/address-icon.png"></td>
<td height="25" style="color:rgb(19, 41, 75);vertical-align:middle"><a href="https://goo.gl/maps/Z8bPMxE1q5PJ9Tvk8" color="#13294B" style="font-size:9pt" class="ContentPasted2"><span style="color: rgb(19, 41, 75);">P. Empresarial El Carralero, 4. 28222 Majadahonda.
 Madrid (SPAIN)</span></a></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<div style="font-family:Arial;font-size:8pt;color:rgb(158, 158, 158)">
<p class="ContentPasted2">Este mensaje y cualquier archivo adjunto está destinado únicamente a quien se dirige y es confidencial. Si usted ha recibido este mensaje por error, comuníqueselo al remitente y bórrelo inmediatamente. La utilización, revelación y/o
 reproducción del mensaje puede constituir un delito.</p>
<p class="ContentPasted2">PROTECCIÓN DE DATOS – Responsable: AVALON INFORMÁTICA Y SERVICIOS, S.L.U. Finalidad. Envío de información, respuesta a consultas y contactos genéricos, mientras dure nuestra relación y tengamos su consentimiento. Destinatarios. No
 se cederán datos a terceros salvo obligación legal. Derechos. Puede ejercer los derechos de acceso, rectificación, supresión y oposición, limitar el tratamiento de sus datos, o directamente oponerse al tratamiento, o ejercer el derecho a la portabilidad de
 los mismos. Todo ello, mediante escrito, acompañado de copia de documento oficial que le identifique, dirigido al RESPONSABLE. En caso de disconformidad con el tratamiento, también tiene derecho a presentar una reclamación ante la Agencia Española de Protección
 de Datos. También podrá oponerse a nuestros envíos de comunicaciones comerciales (Art.21.2 de la LSSI) a través de la siguiente dirección de correo electrónico: info@avaloninformatica.com.</p>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
</div>
</div>
</body>
</html>