Imagine I have four files I want to encrypt. I have master key, and from that master key I derive four keys, one for each file:
key1 = HMAC-SHA-2(masterKey, filename1) key2 = HMAC-SHA-2(masterKey, filename2) key3 = HMAC-SHA-2(masterKey, filename3) key4 = HMAC-SHA-2(masterKey, filename4)
After that, I encrypt each file with AES, each with its own derived key (file1 encrypted with key 1, file2 encrypted with key2, etc).
Imagine Alice (owner of the master key) publishes every encrypted file publicly and only shares key3 with Bob.
Is it then safe to assume that Bob will only be able to decrypt file three because he only has key3, and no one else will be able to encrypt the other files (except Alice)?
Is Bob able to decrypt the other files, when he knows that his key was made by using HMAC-SHA-2(masterKey, filename3), even though he doesn't have the keys for the other files?
If all four keys are handed out to one person (and that person also knows the four filenames) , is that person then able to derive the master key?