I have a key (of random binary data) that gets generated by get_key.
And with this key, I can do several things with my encrypted files. For example, I can decrypt them.
get_key | tee >(decrypt file1) >(decrypt file2)
I would like to know how I could generalize that to n files where the files are given as FILES=file1 file2 file3 file4 file5.
At the moment, I can see two solutions:
1) Compute a string and eval it
2) replace decrypt by a recursive function f that calls decrypt does tee >(decrypt A[0]) | f ("${A[@]:1}") (it decrypts the first element and calls itself recursively) if the array is not empty and nothing if it is.
I wanted to know if you had a nicer way to doing that (note that I do not want the key to be written to a file or a variable, so loops aren't an option).
Edit: I'll use it in https://github.com/xavierm02/combine-keys
cryptsetup, I think you're barking up the wrong tree. You should carefully think about your security requirements (what are the risks? what are the attack vectors?) and infrastructure (when are you doing this — presumably in the boot process? what information and tools do you have available?) and ask one or more higher-level question about that.