Delphi EIdOSSLUnderlyingCryptoError Exception – SSL3_GET_RECORD Wrong Version Number

  

I tried using TRESTClient to connect to an HTTPS web service using TLS 1.2. But NO LUCK with sending multipart/form-data.

So now I am trying with Indy. I got this “Wrong Version Number” error.

I think there is nothing wrong with the code since it worked with HTTP.

Probably my Delphi is missing something. What should I install and how?

procedure TForm10.Button2Click(Sender: TObject);
var
HTTP: TIdHTTP;
RequestBody: TStream;
ResponseBody: string;
myssl: TIdSSLIOHandlerSocketOpenSSL;
Input: TIdMultipartFormDataStream;
begin
ResponseBody := ”;
try
try
HTTP := TIdHTTP.Create;
try
Input := TIdMultipartFormDataStream.Create;
try
Input.Clear;
Input.AddFormField(‘Email’, ‘xx@xx.com.tr’);
Input.AddFormField(‘Password’, ‘xx’);

myssl := TIdSSLIOHandlerSocketOpenSSL.Create(HTTP);
HTTP.IOHandler := myssl;
myssl.SSLOptions.Mode := sslmUnassigned;
myssl.SSLOptions.Method := sslvTLSv1_2;
myssl.SSLOptions.SSLVersions := [sslvTLSv1_2];
HTTP.HTTPOptions := [hoForceEncodeParams];

HTTP.Request.CustomHeaders.FoldLines := False;
ResponseBody := HTTP.Post(‘https://xxx.com.tr/api/Mobile/MobileLoginControl’, Input);

finally
Input.Free;
end;
finally
HTTP.Free;
end;
finally
end;
except
ResponseBody := ‘”-20″‘;
end;
end;

Comments are closed.