How to store a key ?
Do you know how to store a generated key for future use ?
What I'm trying to do is:
1. Encrypt the given data in a simple way:
KeyGenerator kg = KeyGenerator.getInstance("DES");
Key key = kg.generateKey();
Cipher cipher = Cipher.getInstance("DES");
.... // encrypting goes here
2. Store the encrypted data to a file.
3. Run the application again, read the file and decrypt the data, so that I can use it in some way.
I've got everything working except the decryption point - I get an exception - which I don't get if I do not restart the app and thus keep the original key used for encryption.
I assume I need to store the original encryption key somehow if I want to decrypt the file.
How can I do this ?
Thanks a lot in advance :)

