Android Question FTP over SSL fails

dannyjon

Member
Licensed User
Longtime User
This worked ok before I used SSl but now it does initialize but the download fails. I've checked many example here but can not see where I am going wrong. I have net lib v1.81. I also have SSHJ but this fails to initialize at all. Thank you.
FTP over SSL:
    Try
          
  
        ftpclient.Initialize("FTP", "ftp.x.net", 21, "x", "x")
        ftpclient.TimeoutMs=500
        ftpclient.PassiveMode=True
        ftpclient.UseSSL=True
        Log("FTP Initialized")
        ftpclient.UseSSLExplicit=False
  
        If ftpclient.IsInitialized=True Then
  
            Dim ftpdownload As Object = ftpclient.DownloadFile("/x/x/x.jpg",False,main.shared,"a.jpg")
            wait for (ftpdownload) FTP_DownloadCompleted (ServerPath As String, Success As Boolean)
      
            If Success=True Then
                Log("projects ftp good.")
            Else
                Log("failed projects ftp downloaded.")
            End If
        End If
      
    Catch
        Log(LastException)
      
    End Try
 

teddybear

Well-Known Member
Licensed User
Try using
B4X:
 ftpclient.UseSSLExplicit=true

 ftpclient.UseSSL=false
Maybe the implicit mode is deprecated
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
But a server must support it first of all, maybe it does not support.
Is SFTP protocol not the same ?
 
Upvote 0

teddybear

Well-Known Member
Licensed User
Try adding
B4X:
dim ctm As CustomTrustManager
ctm.InitializeAcceptAll
ftpclient.SetCustomSSLTrustManager(ctm)
 
Upvote 0
Top