Stellen Sie eine FrageStellen Sie eine Frage
 

BeantwortetreqFTP.EnableSsl = true;

  • Samstag, 2. Juni 2007 18:03myNameIsRon TeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillen
     

    Hi,

    I'm using a hosting company that offers FTPS, but because the certificate is self signed it's coming up with an error.

    Is it possible to bypass the certificate error (exception) and still login? I notice that with other FTP programs (FileZilla), you can choose to trust the certificate if it doesn't pass inspection.

     

    thanks,

    Ron

Antworten

  • Sonntag, 3. Juni 2007 21:40timvw TeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillen
     Beantwortet
    And which library are you using?

    (If installing your certificate as a trusted one isn't an option, for .Net libs you would use the  ServicePointManager.ServerCertificateValidationCallback to plugin your own validator...)
  • Sonntag, 3. Juni 2007 22:29myNameIsRon TeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillen
     Beantwortet

     

    Hi timvw,

    Ops, yes that would have been a good thing to include Surprise)

    The certificate error is "Self Signed Certificate". I'm just trying to use FTP over SSL to protect my FTP login ID and Password.

     

    I'm using FtpWebRequest

    I kept looking, and as you said... ServicePointManager, I did find this code on the web... and it does seem to work.

    Is this the best way to go about it?

    ----------------------------------------------------------------------------------------------------------------------------

    ServicePointManager.ServerCertificateValidationCallback = AcceptAllCertificatePolicy;

     

    //Code to Accept All Certificates

    public static bool AcceptAllCertificatePolicy(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)

    {

    return true;

    }

     

    Thanks,

    Ron

  • Montag, 4. Juni 2007 05:26timvw TeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillen
     Beantwortet
    As long as you're not doing anything else your code would be enough... But I would probably only return true if the certificate is your own self-signed certificate and in all other cases rely on default validation...

Alle Antworten

  • Sonntag, 3. Juni 2007 21:40timvw TeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillen
     Beantwortet
    And which library are you using?

    (If installing your certificate as a trusted one isn't an option, for .Net libs you would use the  ServicePointManager.ServerCertificateValidationCallback to plugin your own validator...)
  • Sonntag, 3. Juni 2007 22:29myNameIsRon TeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillen
     Beantwortet

     

    Hi timvw,

    Ops, yes that would have been a good thing to include Surprise)

    The certificate error is "Self Signed Certificate". I'm just trying to use FTP over SSL to protect my FTP login ID and Password.

     

    I'm using FtpWebRequest

    I kept looking, and as you said... ServicePointManager, I did find this code on the web... and it does seem to work.

    Is this the best way to go about it?

    ----------------------------------------------------------------------------------------------------------------------------

    ServicePointManager.ServerCertificateValidationCallback = AcceptAllCertificatePolicy;

     

    //Code to Accept All Certificates

    public static bool AcceptAllCertificatePolicy(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)

    {

    return true;

    }

     

    Thanks,

    Ron

  • Montag, 4. Juni 2007 05:26timvw TeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillen
     Beantwortet
    As long as you're not doing anything else your code would be enough... But I would probably only return true if the certificate is your own self-signed certificate and in all other cases rely on default validation...
  • Freitag, 3. August 2007 01:19just.a.nerd TeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillen
     
     myNameIsRon wrote:

     

    I'm just trying to use FTP over SSL to protect my FTP login ID and Password.

     

     

    I wish, more people would do just that.

    And, in that case a self-signed certificate is just as good as one, that makes rich people richer !