Suppose we have a master key, and we want to encrypt some file(s). We then generate one-time key for that file, use it to encrypt file contents, and finally encrypt one-time key using master key (with IV, padding and so on). Fairly common scheme, isn't it?
So, we now want to generate one-time key and store it somewhere in the encrypted file. Straightforward approach is to generate one-time key and IV and use some cipher (in my case it's AES in CBC mode) to encrypt one-time key with master key. After that we store IV and encrypted one-time key in some file. This is pretty standard way too.
So in short, we go from unencrypted random value to encrypted one.
But we can also move in reverse direction. We can fill some buffer with random bytes, then pretend that this buffer is serialized one-time key, decrypt one-time key back from that buffer, and use it to encrypt our file. In that case, instead of having two separate procedures for encryption and decryption of one-time keys, we can keep only decryption procedure.
The question: is it okay to use that trick? Any caveats or pitfalls? Any additional constraints applied to RNG used?
Basically, I just want to make sure that such a simplification won't break security.