Hi Tauren,

Try this:

Key key = cipherService.generateNewKey();
String base64 = new SimpleByteSource(key.getEncoded()).toBase64();

Then put the base64 string somewhere (in a props file, etc).

When you need to reverse the process, you can do this:

byte[] bytes = Base64.decode(encoded);

You'll use the 'bytes' variable as your argument to the CipherService methods.

Does that help?

Cheers,

Les

P.S.  That reminds me.  I think it'd be a good idea to have a Cryptor
interface - a component that stores the key as an internal attribute
so encryption and decryption operations don't require a key argument.
It would probably itself use an internal CipherService to do its
work...

Reply via email to