Martijn Verburg wrote:I think you're after the KeyFactory API...
Thank you for replying..
I did check the key factory but it only generate private and public keys and I want a symmetric key.
I tried to check the java.Security.Spec but the classes that are instantiable are specs for private and public keys.
can you please show me how i can use the keyfactory to generate symmetric keys..
Hey cool! I've never worked with saving off keys etc (as you can tell my KeyFactory pointer was well off the mark), interesting stuff!
Joined: Nov 14, 2008
Henry Wong wrote:
To generate a symmetric key, you need the encoding and the algorithm, which you can get from key like so...
You can, of course, save these components to a file... Later, after you read these back from the file, you can regenerate your symmetric key as follows...
Thank you for this too. it solved another problem where i need to seal session keys with public keys. I didn't know about the SecretKeySpec under javax.crypto.spec. because I was looking under the java.security.spec.* only.