Bonjour,
J'ai un problème avec une connexion a un serveur FTP distant sécurisé TLS/SSL. La connexion doit se faire en passive/implicite
Voici deja un log de FilleZilla (connexion fonctionnel)
On peut voir que la connexion ce fait via un certificat (fillezilla m'avais demander si je l'accepter)Statut : Connexion à IP:PORT...
Statut : Connexion établie, initialisation TLS...
Statut : Vérification du certificat...
Statut : Connexion TLS/SSL établie, attente du message d'accueil...
Réponse : 220 ******
Commande : USER Identifiant
Réponse : 331 Password required for Identifiant
Commande : PASS **********
Réponse : 230 Logged on
Commande : PBSZ 0
Réponse : 200 PBSZ=0
Commande : PROT P
Réponse : 200 Protection level set to P
Statut : Connecté
Dans mon code j'ai donc implémenter ce qui normalement doit définir ma politique pour géré les certificats. Pour des raisons de test je les acceptes tous.
D'après social.msdn la connexion sécurisé implicite ne serais pas supporter par DotNet...
http://social.msdn.microsoft.com/For...a-34cf09111c7d
Voici ma méthode principale
Voici la fonction myCertificateValidation
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(myCertificateValidation); reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + ftpServerIP + "/")); reqFTP.UsePassive = true; reqFTP.EnableSsl = true; reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword); reqFTP.Method = WebRequestMethods.Ftp.ListDirectory; WebResponse response = reqFTP.GetResponse();
Actuellement l'erreur renvoyé est
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 public bool myCertificateValidation(Object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors Errors) { return true; }
Le serveur distant a retourné une erreur*: 234 Using authentication type TLS.
Partager