Hola buenas, antes de nada gracias por todo el codigo que la gente comparte.
Estoy usando un php para realizar el envio, y cuando introducco los certificados PEM siempre me responde con nada, si no los pongo al menos me dice que no introduje los certificado, pero almenos responde, alguien sabe donde puede estar el problema??
Los certificados PEM los he sacado con OPENSSL
openssl pkcs12 -in C:\Users\IndaG\Desktop\TBAI_PRUEBAS\PFX.pfx -out C:\Users\IndaG\Desktop\TBAI_PRUEBAS\ca.pem -cacerts -nokeys
openssl pkcs12 -in C:\Users\IndaG\Desktop\TBAI_PRUEBAS\PFX.pfx -out C:\Users\IndaG\Desktop\TBAI_PRUEBAS\client.pem -clcerts -nokeys
openssl pkcs12 -in C:\Users\IndaG\Desktop\TBAI_PRUEBAS\PFX.pfx -out C:\Users\IndaG\Desktop\TBAI_PRUEBAS\key.pem -nocerts
Código PHP:
<?php
$xmlStr = file_get_contents('.\firmado.xml');
$ch = curl_init('URL');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSLCERT,'/client.pem');
curl_setopt($ch, CURLOPT_SSLKEY,'/key.pem');
curl_setopt($ch, CURLOPT_CAINFO,'/ca.pem');
curl_setopt($ch, CURLOPT_SSLKEYPASSWD, "INDAVE");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlStr);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/xml; charset=utf-8'));
$resp = curl_exec($ch);
$size_response = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
echo$size_response;
$header_response = substr($resp, 0, $size_response);
$body_response = substr($resp, $size_response);
echo $body_response;
//echo $resp;
curl_close($ch);