Android Question Whats the best practice for encrypting a log file?


Active Member
Licensed User
Longtime User

In our app, a log file is to be written for security purposes, in which the database queries are stored in order to read them into a sqlite if required.
To prevent unauthorized access to this data, the log file is to be encrypted. The decryption must be possible on a (Windows) PC.
A problem could be that the file is probably opened quite often for writing, therefore the process must not take too long.

Does anyone have an idea for the best way to do this?



Well-Known Member
Licensed User
Longtime User
You have two options
1. use B4XEncryption to create a B4A app and a B4J app which runs on your Windows pc

2. Use Use B4XEncryption in your B4A app and DLL in your PC app
Upvote 0


B4X founder
Staff member
Licensed User
Longtime User
The way I would have done it is by encrypting each block(?) of logs separately, write the encrypted bytes length and then the encrypted bytes.
On the PC you need to read the length of each block, read the block and decrypt it.

Writing the logs will be fast as you don't need to encrypt the whole data.

Example of encrypting / decrypting large files in chunks:
This is not exactly the same case as this one.
Upvote 0