Android Question FTPS (Net FTP library with .UseSSL)

Status
Not open for further replies.

biometrics

Active Member
Licensed User
Longtime User
Has anyone been able to get FTPS (FTP with SSL) to work?

I can confirm it works with our FTP server (Ubuntu 12.04 with vsftpd) with the following clients:
  • FileZilla Client - configured "Explicit FTP over TLS"
  • VB6 and the Chilkat FTP2 ActiveX - configured ".AuthTls = 1" (AUTH SSL) & ".Ssl = 0" (not using implicit SSL connection)
  • ES File Explorer on the same Android device as my B4A app - configured "encryption" = "explicit"
All the above using port 21.

When running Debug (rapid) or Release I just get the "Error" MsgBox (see code below). When running Debug (legacy) I get a Java error: "java.lang.Exception: Sub libftp_listcompleted signature does not match expected signature."

I have tested with a direct internet connection and via a correctly configured firewall.

I use the following test code. The only option I have is .UseSSL and the port number in the .Initialize call. I can't select implicit or explicit. I've tried setting .UseSSL before and after .Initialize.

When we enable dual SSL and non-SSL modes on the FTP server then the code runs.

Can anybody help me please?

B4X:
Sub Process_Globals
   Dim libFTP As FTP
   Dim libContinueTimer As Timer

   Dim lCurrentState As Long
 
   Dim conStateIdle As Long
   Dim conStateConnecting As Long
   Dim conStateConnected As Long
   conStateIdle = 0
   conStateConnecting = 1
   conStateConnected = 2
End Sub

Sub Globals
End Sub

Sub Activity_Create(FirstTime As Boolean)
  lCurrentState = conStateIdle
 
  libContinueTimer.Initialize("libContinueTimer", 1)
  libContinueTimer.Interval = 1
  libContinueTimer.Enabled = True
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub libContinueTimer_Tick
   libContinueTimer.Enabled = False
 
   Select Case lCurrentState 
   Case conStateIdle
     lCurrentState = conStateConnecting
     libFTP.Initialize("libFTP", "xxx", 21, "xxx", "xxx")
     libFTP.UseSSL = True
     libFTP.PassiveMode = True 
     libContinueTimer.Enabled = True
   Case conStateConnecting
     libFTP.List("/")
   Case conStateConnected
     Msgbox("Ok", "FTPS")
     ExitApplication
   End Select 
End Sub

Sub libFTP_ListCompleted(ServerPath As String, Success As Boolean, Folders() As FTPEntry, Files() As FTPEntry)
  Dim lIndex As Long
  Dim lFileCount As Long

  If Success Then
    lFileCount = Files.Length
   
     For lIndex = 0 To lFileCount - 1
       Log(Files(lIndex).Name)
     Next
   
     lCurrentState = conStateConnected
     libContinueTimer.Enabled = True
   Else
     Msgbox("Error", "FTPS")
     ExitApplication
  End If
End Sub
 

biometrics

Active Member
Licensed User
Longtime User
Hi Erel,

I had both the Net and NetExtras libraries selected. By unselecting NetExtras that error was resolved. I now get the following in the ListCompleted event with Log(LastException):

(SSLProtocolException) javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x2cc510: Failure in SSL library, usually a protocol error
error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol (external/openssl/ssl/s23_clnt.c:683 0x401b4cc3:0x00000000)
 
Upvote 0

biometrics

Active Member
Licensed User
Longtime User
Hi Erel,

When I use ES File Explorer on the device to our FTP server it works fine though ...
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
yes, that´s erels email
 
Upvote 0
Status
Not open for further replies.
Top