Need Help to Understand Decryption Process of Cryptomator

Update:
So I understand Cryptomator encrypts the file in chunks and then again combine these encrypted chunks to one file. So whenever a video is played how cryptomator gets information to decrypt which chunk , how this process works?

Greetings everyone, I want to develop an app in Flutter basically a chat app which will store images and videos in encrypted form. That is easy there are many flutter libraries that can encrypt and decrypt files.
So when user scrolls through the chat he can view thumbnails and if he would want he can also play a video which is in real an encrypted file on internal storage of android device. Please help me how to implement that. There are problems:

  1. Even if I want to show thumbnail when user is scrolling through chat I need to fully decrypt the video file first which will take time and slow down device and then store this decrypted file on some temporary directory in internal storage then view thumbnail or play the video from there. How can I avoid this bad practise? I want to make decryption like Cryptomator I mean On the Fly Decryption and only decrypt (in memory not in internal storage) the data which is required not whole video file.
  2. Media players plays files not streams. So I think I can not decrypt a file in stream and then provide that stream to media player. But if some media player accept stream how to manage when user skip two minute in video?
    I have searched everywhere on stackoverflow but there is no answer.

Alternative: Can I store my files in /data/data or /data/user_de on android without encryption. Because only app can access data from these location on non rooted devices, Also my app targetSDKVersion is Android S so adb backup command also can not fetch data from here.

1 Like