At the moment, the encryption for each file depends on
(nonce, masterKey)
I think what you are proposing is that we derive a per file encryption key
random = 32 bytes (say) of random numbers
fileEncryptionKey = derivationFunction(random, masterKey)
File decrytpted with (nonce, fileEncryptionKey)
We then store
(nonce, random) in the file in the clear.
This would mean that we could decrypt files as normal using the masterKey
. We could also give people fileEncryptionKey
for a single file without compromising masterKey
.
I think that would work, depending on exactly what was used for the derivationFunction
. A hash function keyed on masterKey
would probably be the right approach or maybe we could use scrypt
which rclone uses already, however that is quite computationally expensive.