I've got a small app I wrote that takes a user-created, symmetric encryption key to encrypt files, and am unsure of how to work with the key inside the program.
To be clear, I don't want to store this key anywhere permanently, but obviously I need to pass it as a string or something, or else we can't do anything with it at all.
Some specific questions I have are:
Is it safe to use the key as a string, or would something like a byte array be preferable?
I would think that we would not want to save the decrypted files anywhere within the file system, which means they must be loaded up into the heap (or stack?). In order to do this, the key will need to be reused throughout the duration of the program. Should we avoid storing it as a class/instance variable?
When we close out the program, what should we do with our key variable? Should it be manually overwritten?