| Implicit TLS FTP connection problem |
|
| Re: Implicit TLS FTP connection problem |
|
| Re: Implicit TLS FTP connection problem |
|
Thank you for your answer,
I use the Indy component 10 TidFTP.
Here are two functions that I use in my program. One is used to
configure the connection. The other allows to send a file with the PUT
method.
Since yesterday, I have advanced a little on the issue. I tried to
connect with FileZilla and when connecting I have a certificate request
that I do not have in embarcadero.
If the problem is there, how do I do to get this certificate?
Otherwise you'd have to dig another track?
Sincerely Mr. Graveron
Function TThreadConnexion.ConnectionFtp(IdFTP: TIdFTP; lHandler:
TIdSSLIOHandlerSocketOpenSSL; typeFtp: integer): Boolean;
var
ok: Boolean;
monRepCertif: string;
Begin
ok := False;
AjouteTrace(Traduc('Connexion au serveur FTP'), str_host, TBeginMess);
try
case typeFtp of
0:
begin
AjouteTrace(Traduc('Type de connexion'), Traduc('Non
sécurisée'), TControlValue);
IdFTP.host := str_host;
IdFTP.Username := str_user;
IdFTP.password := str_password;
IdFTP.Port := StrToInt(str_port);
IdFTP.ReadTimeout := 6000;
IdFTP.TransferTimeout := 30000;
end;
1:
begin
AjouteTrace(Traduc('Type de connexion'), Traduc('Implicite
sur TLS'), TControlValue);
lHandler.SSLOptions.Mode := sslmClient;
monRepCertif := REP_APPLI_LOCAL + 'FTPCertif\';
ForceDirectories(monRepCertif);
lHandler.SSLOptions.CertFile :='';
lHandler.SSLOptions.KeyFile := '';
lHandler.SSLOptions.RootCertFile := '';
lHandler.SSLOptions.Method := sslvSSLv3;
lHandler.SSLOptions.VerifyDepth := 0;
IdFTP.IOHandler := lHandler;
IdFTP.host := str_host;
IdFTP.Port := StrToInt(str_port);
IdFTP.Username := str_user;
IdFTP.password := str_password;
IdFTP.UseTLS := utUseImplicitTLS;
IdFTP.DataPortProtection := ftpdpsPrivate;
IdFTP.ReadTimeout := 6000;
IdFTP.AUTHCmd := tAuthTLSP;
end;
end;
Try
If Not IdFTP.Connected Then
Begin
IdFTP.Connect;
AjouteTrace(Traduc('Connexion'), 'OK', TRes);
if IdFTP.UsingSFTP then
AjouteTrace(Traduc('Connexion sécurisée'), 'TRUE', TRes)
else
AjouteTrace(Traduc('Connexion sécurisée'), 'FALSE', TRes);
End
Else
AjouteTrace(Traduc('Connexion'), Traduc('OK : Déjà Connecté'),
TRes);
ok := True;
Except
On E: Exception Do
Begin
AjouteTrace(Traduc('Connexion au serveur FTP'), E.message,
TException);
ok := False;
End;
End;
finally
Result := ok;
AjouteTrace('', '', tEnd);
end;
End;
Function TThreadConnexion.EnvoiFichierFtp(IdFTP: TIdFTP; nomSrc,
nomDest: String): Boolean;
var
ok: Boolean;
Begin
ok := False;
AjouteTrace(Traduc('Envoi fichier FTP'), nomSrc + ' ' +
Traduc('vers') + ' ' + nomDest, TBeginMess);
try
Try
If (str_destination <> '') Then
begin
AjouteTrace(Traduc('Répertoire courant'),
IdFTP.RetrieveCurrentDir, TControlValue);
IdFTP.ChangeDir(str_destination);
AjouteTrace(Traduc('Répertoire courant après changement de
répertoire'), IdFTP.RetrieveCurrentDir, TControlValue);
IdFTP.Put(nomSrc, nomDest);
end
Else
begin
AjouteTrace(Traduc('Destination'), nomDest, TControlValue);
IdFTP.Put(nomSrc, nomDest);
end;
AjouteTrace(Traduc('Envoi'), 'OK', TRes);
ok := True;
Except
On E: Exception Do
Begin
AjouteTrace(Traduc('Impossible d''envoyer le fichier'),
E.message, TException);
ok := False;
End;
End;
finally
Result := ok;
AjouteTrace('', '', tEnd);
end;
End;
* Français - détecté
* Anglais
* Français
* Anglais
* Français
|
| Re: Implicit TLS FTP connection problem |
|