This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
please give help urgent.... In my servlet i am encrypting one message (say userId or pswd) for encryption i am using javax.crypto package algoritham used is DES I am generating key as .. -----------code-------- SecretKey key =KeyGenerator.getInstance("DES").generateKey(); ------------------ Then converting it into String and passing it as requestparameter along with encrypted message. (this is step i can't change ie i need to pass these as requestParameter)
In the second servlet for decryption i need this key ,I am getting that but I am not able to cast it to SecretKey object any solution related to this will be great for me.. or any method to reproduce the same key in the second servlet as in first servlet used for encryption. Any method is available for generating a key with respect to a String given hardcoded...
The Security Guide in the JDK documentation gives an example that includes code converting a key to a byte array, and later converting the byte array back into a key. The example uses a public key, but secret keys are handled in an analogous way. All that remains to do is Base64 encoding it.
I will not ask what you hope to achieve by sending an encrypted message together with its key in an HTTP request :roll:
- Peter [ July 28, 2004: Message edited by: Peter den Haan ]