Les,
I'm sure I'm missing something really basic, but what is the best way to
save and recreate Keys? I want to store a key somewhere so that every time
my app runs, it loads the key and uses it.
Assume I've run the following to create a Key:
AesCipherService cipherService = new AesCipherService();
Key appKey = cipherService.generateNewKey();
1. I need to save this Key as a String to put into a property file or some
other persistent storage. How can I best get a String representation of this
Key? I'm assuming something as simple as this would do the trick:
String mykey = new String(key.getEncoded());
2. When my app starts, it loads the String representation of the Key from
the property file. I'm unclear on how to create a Key from that String.
This is all very simple to do with Salts, but looking at the JSSE docs, I'm
not seeing how to create a Key from a string.
Thanks!
Tauren