Tool Secured Assets - Encrypt your assets files

omidaghakhani1368

Well-Known Member
Licensed User
Longtime User
Hard to say without seeing the error. However this solution is less useful for large files as the decryption will be too slow.
No No Erel.When i encrypt file and use in basic4android,it not have password for large file but in small file have password.My file size is 80 mb
 

tsteward

Well-Known Member
Licensed User
Longtime User
Desktop app SecuredAssets.jar crashes when I try to select the source folder.
I click the button then select a folder that has 11 jpg files totaling 400kb and the app closes without warning or error.
 

tsteward

Well-Known Member
Licensed User
Longtime User
Here is the error
 

Ricardo Bunschoten

Active Member
Licensed User
Longtime User
If i want to crypt txt files that contains urls is that also possible to add then in a db file ?

And then unpack them to use them ?

i now use this code

B4X:
    Private link1 As String = "url.txt"

B4X:
Sub btnDownload_Click
    Filelist = File.ReadList(File.DirAssets, "url.txt")
    Base = Filelist.Get(Filelist.Size - 1)
    Label1.Text = Label1.Text & CRLF
    Log(" ")
    Log("Maximum value for Cnt = " & (Filelist.Size - 2))
    Cnt = 0
    If Cnt <= Filelist.Size - 2 Then
    FN = Filelist.Get(Cnt)
    link1 = Base & FN
    Dim dd As DownloadData
    dd.Url = link1
    dd.EventName = "dd"
    dd.Target = Me
    CallSubDelayed2(DownloadService, "StartDownload", dd)
    Cnt = Cnt + 1
    End If
    End Sub
 

Ricardo Bunschoten

Active Member
Licensed User
Longtime User
What i want is that the url.txt files are crypted so tat when they unpack the apk they can not see the url inside the txt file.
 

Ricardo Bunschoten

Active Member
Licensed User
Longtime User
i did that but your sample code astroids is unpacking images blob files ?

I was not sure what the parameter was to decrypt the crypted txt files files from the db file when they are txt files

maybe i read it wrong ?
 

Ydm

Active Member
Licensed User
Longtime User
I am using version 2 keyvalue. 1.0.1 version gives the SQL error in the Android version 6.
But I get the following error:
Error occurred on line 26 (keyvaluestor A)
the java.io.IOException

in keyvalue place where this error:
B4X:
Public Sub Get(Key As String) As Object
    Dim rs As ResultSet = sql1.ExecQuery2("SELECT value FROM main WHERE key = ?", Array As String(Key))
    Dim result As Object = Null
    If rs.NextRow Then
        result = ser.ConvertBytesToObject(rs.GetBlob2(0))  '!!!!!!!!!!!!!!!!!!!!!!
    End If
    rs.Close
    Return result
End Sub
 

Ydm

Active Member
Licensed User
Longtime User
I've tried. But this time I got the following error(in the B4J):

Error occurred on line: 44 (KeyValueStore)
java.lang.RuntimeException: Cannot serialize object: java.io.BufferedInputStream@2f4951

B4X:
Public Sub PutEncrypted (Key As String, Value As Object, Password As String)
#if B4I
    Dim cipher As Cipher
#else
    Dim cipher As B4XCipher
#end if
    Put(Key, cipher.Encrypt(ser.ConvertObjectToBytes(Value), Password))   '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 44
End Sub

I had to use that file in Main:
B4X:
kvs.PutEncrypted(ci.Text.ToLowerCase, File.OpenInput(txtFolder.Text, ci.Text), _
                txtPassword.Text)

kvs.PutEncryptedObject unavailable.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…