Ver Mensaje Individual
  #2  
Antiguo 09-06-2021
skymota skymota is offline
Registrado
 
Registrado: mar 2011
Posts: 6
Reputación: 0
skymota Va por buen camino
Cita:
Empezado por keys Ver Mensaje
Hola.

Con TIdHTTP creo que no se puede hacer lo de gestionar los certificados. En los ejemplos que encontraras en el foro está hecho con TNetHTTPClient.
Gracias! efectivamente no se puede con TidHTTP

Error mío pq utilicé la librería Chilkat para la firma y no se me ocurrió utilizarla para esto y con esta si que se puede, además de que está documentado y es sencillísimo

Dejo un ejemplo por si le sirve a alguien:

Código:
	
	CkHttp http;
	bool success = http.SetSslClientCertPfx(CERTIFICADO, CONTRASEÑA);
	if (success != true)
	{
		...		
	}

	CkStringBuilder sbXml;
	success = sbXml.LoadFile(FICHERO XML TBAI FIRMADO, "utf-8");
	if (success != true)
	{
		...
	}

	const char *strXml = sbXml.asString();

	http.SetRequestHeader("Content-Type", "application/xml");
	http.SetRequestHeader("Content-Encoding", "utf-8");

	const char *strURL = ((AnsiString)usURL).c_str();
	CkHttpResponse *resp = http.PostXml(strURL, strXml, "utf-8");
	if (http.get_LastMethodSuccess() != true)
	{
		...
	}
Responder Con Cita