Problem: I read and write large multipage tiffs. During my test I have seen plain tiffs on disk. I know I can disable writing to disk with
ImageIO.setUseCache(false)
but then all data is in memory, what may lead to OutOfMemoryException.
Is there any way to encrypt the cache/temp file created by ImageIO.createImageInputStream() and ImageIO.createImageOutputStream()?
My current variants, what I can/will try
- Registering a custom ImageInputStream/ImageOutputStream(Spi)for encrypted files similar to "javax.imageio.stream.FileImageInputStream". Is there any documentation/tutorial how to do that?
- Extends RandomAccessFile to write encrypted and read decrypted to/from file due to existing "javax.imageio.stream.FileImageInputStream" already accepts RandomAccessFile. Is there already a solution for that?
- last hope is to secure/encrypt the temp folder outside of my java app, but that would be error prone.
PS: I would use AES128/256 encryption with temp. key/IV (save that in memory) !