Reformulating the question ...
I was able to get response from webserve, but it is returning the following error:
I need to encapsulate a digital certificate next to the request and I do not know how to do this, so I researched I need to do something with the properties of the TIdSSLIOHandlerSocketOpenSSL class, but I do not know how to do it.
Here are the properties I searched for:
IdSSLIOHandlerSocketOpenSSL.SSLOptions.CertFile IdSSLIOHandlerSocketOpenSSL.SSLOptions.KeyFile IdSSLIOHandlerSocketOpenSSL.SSLOptions.RootCertFile
Wall I need to put the path of some file in them, I do not know.
Here is the code I'm using:
procedure TForm2.Button2Click(Sender: TObject);
var
str: TStringList;
strResp : TStringStream;
IdHTTP: TIdHTTP;
IdSSLIOHandlerSocketOpenSSL: TIdSSLIOHandlerSocketOpenSSL;
begin
str := TStringList.Create;
strResp := TStringStream.Create('');
IdHTTP := TIdHTTP.Create(nil);
IdSSLIOHandlerSocketOpenSSL := TIdSSLIOHandlerSocketOpenSSL.Create(IdHTTP);
IdSSLIOHandlerSocketOpenSSL.SSLOptions.Method := sslvTLSv1_2;
IdHTTP.IOHandler := IdSSLIOHandlerSocketOpenSSL;
IdHTTP.Request.CustomHeaders.Clear;
IdHTTP.Request.CustomHeaders.AddValue('Role-Type','IMPEXP');
IdHTTP.Post('https://val.portalunico.siscomex.gov.br/portal/api/autenticar',str, strResp);
Memo1.Lines.Text := strResp.ToString;
end;