Please post the full error message and the relevant code.
Sub Class_Globals
Private fx As JFX
Private ftp As FTP
Private sftp As SFtp
Private ctm As CustomTrustManager
Private ftpUser As String
Private ftpUserPswd As String
Private ftpHost As String
Private ftpPort As Int
Private ftpPassive As Boolean
Private ftpFolder As String
Private ftpSSLimplicit As Boolean
Private ftpSSLexplicit As Boolean
End Sub
Public Sub Initialize(Host As String, User As String, Password As String, _
port As Int, PassiveMode As Boolean, folder As String, Encryption As String)
ftpHost = Host
ftpUser = User
ftpUserPswd = Password
ftpPort = port
ftpPassive = PassiveMode
ftpFolder = folder
If Encryption = "SSL - Implicit" Then
ftpSSLimplicit = True
ftpSSLexplicit = False
Else if Encryption = "SSL - Explicit" Then
ftpSSLimplicit = False
ftpSSLexplicit = True
Else
ftpSSLimplicit = False
ftpSSLexplicit = False
End If
ctm.InitializeAcceptAll
ftp.SetCustomSSLTrustManager(ctm)
End Sub
Public Sub SendFileTest(FileandPath As String, ClassCalled As Object)
Dim sPath As String = File.GetFileParent(FileandPath)
Dim sFile As String = File.GetName(FileandPath)
ftp.Initialize("FTPTest", ftpHost, ftpPort, ftpUser, ftpUserPswd)
ftp.PassiveMode = ftpPassive
ftp.UseSSL = ftpSSLimplicit
ftp.UseSSLExplicit = ftpSSLexplicit
ftp.UploadFile(sPath, sFile, False, ftpFolder & sFile)
End Sub
SetSystemProperty("ftp:ssl-protect-data",True)
you could try adding
B4X:SetSystemProperty("ftp:ssl-protect-data",True)
source -> https://stackoverflow.com/questions/22615019/ftps-implicit-tls-ssl-error ( last answer on page )
ftp.SendCommand("PROT", "P")
You are testing it with a non-trusted certificate, right? You should test it with the accept all CustomTrustManager.
ctm.InitializeAcceptAll
ftp.SetCustomSSLTrustManager(ctm)
You are testing it with a non-trusted certificate, right? You should test it with the accept all CustomTrustManager.
Sub Class_Globals
Private fx As JFX
Private ftp As FTP
Private sftp As SFtp
Private ctm As CustomTrustManager
Private ftpUser As String
Private ftpUserPswd As String
Private ftpHost As String
Private ftpPort As Int
Private ftpPassive As Boolean
Private ftpFolder As String
Private ftpSSLimplicit As Boolean
Private ftpSSLexplicit As Boolean
'ftp
' C = Clear P=Protected
Private sPROT_Action As String
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize(Host As String, User As String, Password As String, _
port As Int, PassiveMode As Boolean, folder As String, Encryption As String)
ftpHost = Host
ftpUser = User
ftpUserPswd = Password
ftpPort = port
ftpPassive = PassiveMode
ftpFolder = folder
If Encryption = "SSL - Implicit" Then
ftpSSLimplicit = True
ftpSSLexplicit = False
sPROT_Action = "P"
Else if Encryption = "SSL - Explicit" Then
ftpSSLimplicit = False
ftpSSLexplicit = True
sPROT_Action = "P"
Else
ftpSSLimplicit = False
ftpSSLexplicit = False
sPROT_Action = "C"
End If
ctm.InitializeAcceptAll
ftp.SetCustomSSLTrustManager(ctm)
End Sub
Public Sub SendFileTest(FileandPath As String)
Dim sPath As String = File.GetFileParent(FileandPath)
Dim sFile As String = File.GetName(FileandPath)
ftp.Initialize("FTPTest", ftpHost, ftpPort, ftpUser, ftpUserPswd)
ftp.PassiveMode = ftpPassive
ftp.UseSSL = ftpSSLimplicit
ftp.UseSSLExplicit = ftpSSLexplicit
ftp.SendCommand("PROT", sPROT_Action)
'ftp.SendCommand("PBSZ", "0")
ftp.UploadFile(sPath, sFile, False, ftpFolder & sFile)
End Sub
It is possible that the underlying Apache Net library doesn't support this mode.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?