11-25-2023, 12:32 PM
Good morning, when trying to make an https.post request with a certificate, I get the error:
EIdOSSLLoadingKeyError with message: 'could not load key, check password. error: 0B080074:x509 certificate routines:X509_check_private_key:key values mismatch'.
My code is:
data := TIdMultiPartFormDataStream.Create;
http := TIdHTTP.Create;
IdSSLIOHandler := TIdSSLIOHandlerSocketOpenSSL.Create;
try
IdSSLIOHandler.SSLOptions.SSLVersions := [sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2];
IdSSLIOHandler.SSLOptions.Mode := sslmClient;
IdSSLIOHandler.SSLOptions.Method := sslvSSLv23;
IdSSLIOHandler.SSLOptions.CertFile := 'certificado.pem';
IdSSLIOHandler.SSLOptions.KeyFile := 'claveprivada.pem';
IdSSLIOHandler.OnStatusInfoEx := IdSSLIOHandlerSocketOpenSSL1StatusInfoEx;
http.IOHandler := IdSSLIOHandler;
http.Request.ContentEncoding := 'utf-8';
http.Request.ContentType := 'application/xml';
http.Request.CharSet := 'utf-8';
data.AddFile('UploadedXml', 'File.xml', '');
try
queRespuesta := http.Post('https://xxxxxxx', data);
except
on e:Exception do begin
ShowMessage(e.Message);
end;
end;
finally
http.Disconnect;
http.Free;
data.Free;
IdSSLIOHandler.Free;
end;
Thanks for the help.
EIdOSSLLoadingKeyError with message: 'could not load key, check password. error: 0B080074:x509 certificate routines:X509_check_private_key:key values mismatch'.
My code is:
data := TIdMultiPartFormDataStream.Create;
http := TIdHTTP.Create;
IdSSLIOHandler := TIdSSLIOHandlerSocketOpenSSL.Create;
try
IdSSLIOHandler.SSLOptions.SSLVersions := [sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2];
IdSSLIOHandler.SSLOptions.Mode := sslmClient;
IdSSLIOHandler.SSLOptions.Method := sslvSSLv23;
IdSSLIOHandler.SSLOptions.CertFile := 'certificado.pem';
IdSSLIOHandler.SSLOptions.KeyFile := 'claveprivada.pem';
IdSSLIOHandler.OnStatusInfoEx := IdSSLIOHandlerSocketOpenSSL1StatusInfoEx;
http.IOHandler := IdSSLIOHandler;
http.Request.ContentEncoding := 'utf-8';
http.Request.ContentType := 'application/xml';
http.Request.CharSet := 'utf-8';
data.AddFile('UploadedXml', 'File.xml', '');
try
queRespuesta := http.Post('https://xxxxxxx', data);
except
on e:Exception do begin
ShowMessage(e.Message);
end;
end;
finally
http.Disconnect;
http.Free;
data.Free;
IdSSLIOHandler.Free;
end;
Thanks for the help.