Dokan filesystem en- decryption

Hi!

So I’ve been through some Cryptomator code and I have a couple questions regarding the Dokan filesystem and en- decryption.

I discovered that, when the request on the Dokan filesystem is made => writeFile, but the file size is too large - e.g. 100KB, the writeFile is called n times but with smaller buffer size: e.g. 50KB(n1), 50KB(n2).

So the question is - How does the Cryptomator handle these requests so that the final output file can be split into 32KiB chunks and each chunk can be successfully decrypted. :thinking:

To be more precise, how does Cryptomator connect these parts (50KB, 50KB) together?

Part1, encrypted: 32KiB, 18KiB

Part2, encrypted: 32KiB, 18KiB

Final, encrypted: 32KiB, 18KiB, 32KiB, 18KiB - whole file decryption will result in error – since we are splitting the file into 32KiB chunks.

Same with the readFile function. It appears to give us a buffer with more or less random length values that contain(- but are not limited to) values of 4096 and/or 32768 (rawBufferLength). So the second question is how does the Cryptomator read whole 32KiB chunks when only given a buffer of length < chunkSize. :thinking:

(I hope I understood these methods correctly :sweat_smile:)

Thanks in advance! :grin:

© 2020 Skymatic GmbH • Privacy PolicyImpressum