I'm attempting to connect to an online API using Indy HTTP client. The error I'm getting is "Authorisation failed (that's our message) EIdOSSLUnderlyingcryptoerror Error connecting with SSL, error:14094410: ssl ROUTINES:SSL3_READ_BYTES:SSLV3 alert handshake failure."
The idSSLIOHandler is set with the mode as sslmClient.
`procedure TOnLineSettingsForm.Button5Click(Sender : TObject);
var
S: TStringStream;
R : TStringStream;
sTest : String;
sResponse : String;
sAuthCode : AnsiString;
begin
//S := TStringList.Create;
R := TStringStream.Create;
if Length(edCert.Text) <> 0 then
begin
try
try
sAuthCode := 'AUTHORISATION:' + edCert.Text;
S := TStringStream.Create('AUTHORISATION:' + edCert.Text, TEncoding.UTF8);
S.Position := 0;
with IdHTTP1 do
begin
IOHandler := IdSSLIOHandlerSocketOpenSSL1;
Post('https://api.cloudwaitress.com/V1/...', S); // sAuthCode);
sResponse := ResponseText;
end;
sTest := R.DataString;
except
on e:exception do
begin
Showmessage('Authorisation failed....' + e.ClassName + ' ' + e.Message);
sTest := R.DataString;
end;
end;
finally
s.Free;
R.Free;
end;
end else
begin
Beep;
Beep;
ShowMessage('Please enter the id code.');
end;
end;`
The documentation says the folowing is required for authentication
curl https://api.cloudwaitress.com/v1/... -H "Authorization: YOUR_API_KEY"
I was concerned that the "..." at the end of the url would be invalid, so I left it out. Got the error so put it back. Same error. So, I suspect, the problem is with something else. I note the authorisation doesn't include anything about content type. Although other requests for this API do and require "application/json".
Is it possible a handshake failure simply means the API connection isan't valid?
Sorry - should have said - the Indy version is 10.6.1.5182. I note that the same error can be triggered if TLS is required on the server. And that Indy 10.6.2 fixed that problem. Could it be I nned to get a more recent version of Indy?
Thanks
Alan