For security reasons we need to work in memory index. This is why we are working with the RAMFolder instead of FSFolder. It is tested and it seems to be working good as long as an OOM issue occurs.
The question is at some point we need to encrypt the index (RAMFolder) and save it in disk in encrypted format. Adding in memory index to FS index and then encrypting FS index then deleting the FS index is not an option due to security reasons.
So my question is how can we achieve it. Is it possible to serialize/deserialize the whole RAM folder to a buffer, so it would be possible for us to encrypt the buffer (or decrypt to a buffer) only? This would be an ideal solution for us but I could not find any information about it in the code.
If this is not an option, is it possible to traverse the RAMFolder and find the files in folders, then it would be possible for us to create the same structure where file contents are encrypted individually?
Please let me know if you need any clarifications