gkenji's post in API Rest Certificado Digital P12 was marked as the answer
3 Maio, 2021
Consegui, usando o INDY..
HttpClient := TIdHTTP.Create( nil );
HttpClient.ConnectTimeout := 20000;
HttpClient.IOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
with TIdSSLIOHandlerSocketOpenSSL(HttpClient.IOHandler).SSLOptions do
begin
CertFile := [CaminhoCertificado.crt.pem]; //mudar caminho certificado aqui
KeyFile := [CaminhoCertificado.key.pem]; //mudar caminho certificado aqui
Mode := sslmUnassigned;
SSLVersions := [sslvTLSv1_2]; //mudar protocolos de SSL aqui
end;
with HttpClient do
begin
Request.CustomHeaders.Values['Content-Type'] := 'application/json; application/x-www-form-urlencoded;';
Request.ContentType := 'application/json';
Request.CharSet := 'utf-8';
Request.UserAgent := 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Acoo Browser; GTB5; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; Maxthon; InfoPath.1; .NET CLR 3.5.30729; .NET CLR 3.0.30618)';
HandleRedirects := True;
HTTPOptions := [hoKeepOrigProtocol, hoInProcessAuth];
end;
Body:= '[conteudo body]'; //mudar body aqui
JsonToSend := TMemoryStream.Create;
WriteStringToStream(JsonToSend, Body, IndyTextEncoding_UTF8);
JsonToSend.Position := 0;
sResponse := HttpClient.Post([URL],JsonToSend); //mudar URL aqui