B4J Question Application not running on Linux

Fabrice La

Active Member
Licensed User
Longtime User
I am using SQLite to record user data Username, Password, ..
Password are crypted using HexCrypt module.

In Windows it is fine

If I take the the jar file to linux.

the program stop just after log("Avant")
B4X:
Dim m As Map
    m = DBUtils.ExecuteMap(Main.BDD, "SELECT * FROM UserLogin WHERE login = ?", _
        Array As String(TFName.Text))
        Log(TFName.Text)
    If m.IsInitialized = False Then
        conx = False
    Else
        conx = True
        frommdp = m.Get("mdp") 'keys are lower cased!
        Log(PasswdF.Text)
        If PasswdF.Text <> "" Then
            Log("Avant")
            mdp = HexCrypt.Crypt("de", frommdp, "CleStructure", TFName.Text)
            Log("Apres")
        Else
            mdp = ""
        End If

.........

Public Sub Crypt(sAction As String, sStrInput As String, sCryptKey As String, sName As String) As String
  sAction = sAction.ToUpperCase
  Select sAction.ToUpperCase
  Case "de".ToUpperCase
      Return FromHexaString(sStrInput, sCryptKey, sName)
  Case "en".ToUpperCase
      Return ToHexaString(sStrInput, sCryptKey, sName)
  End Select
  Return "Rien"
End Sub
Private Sub FromHexaString(sStr As String, sCryptKey As String, sName As String) As String
    Dim sRes As String
    Dim raf As RandomAccessFile
    raf.Initialize(File.DirApp & "/.ndf", sName & ".dat", False)
    sRes = raf.ReadObject(raf.CurrentPosition)
    raf.Close
Return sRes
End Sub
 

Fabrice La

Active Member
Licensed User
Longtime User
The database is found as the TFName.Text is show from it but mdp can't be decrypted.

On the log in linux Log(File.DirAssets) gives AssetsDir ....

Which file do you mean ?
 
Last edited:
Upvote 0

Fabrice La

Active Member
Licensed User
Longtime User
if I skip the part:
mdp = HexCrypt.Crypt("de", frommdp, "CleStructure", TFName.Text)

The rest of the appli run like in windows (read data, write data)
 
Upvote 0

Fabrice La

Active Member
Licensed User
Longtime User
File.DirAssets is a virtual read-only folder. You shouldn't use RandomAccessFile with this folder.

I am not using File.DirAsset in my code for Crypt :

B4X:
Dim raf As RandomAccessFile
    raf.Initialize(File.DirApp & "/.ndf",sName & ".dat",False)
    raf.WriteObject(sStr,True,raf.CurrentPosition)
    raf.Close
    Dim TR As TextReader
    TR.Initialize(File.OpenInput(File.DirApp & "/.ndf",sName & ".dat"))
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…