Issue moving from JDK 1.4 to 1.5

2007-01-10 Thread Peter Hendry
The class attached contains test code that works Ok under JDK 1.4 but has never worked under 1.5. The scenario is where the secret key is to be included with the message and encrypted using a public key then decrypted by the recipient using their private key. When the key is decrypted an instan

Re: Issue moving from JDK 1.4 to 1.5

2007-01-10 Thread Peter Hendry
Sorry, I forgot the error produced in JDK 1.5 Original Exception was java.security.InvalidKeyException: Wrong algorithm: DESede or TripleDES required     at org.apache.xml.security.encryption.XMLCipher.decryptToByteArray(Unknown Source)     at org.apache.xml.security.encryption.XMLCipher.decry

Re: Issue moving from JDK 1.4 to 1.5

2007-01-10 Thread Vishal Mahajan
Problem seems to be in this line: final SecretKey unwrappedKey = (SecretKey)cipher.decryptKey(encryptedKey, XMLCipher.RSA_v1dot5); The second parameter to decryptKey method needs to be the symmetric key algorithm. Vishal Peter Hendry wrote: Sorry, I forgot the error produced in JDK 1.5 O

Re: Issue moving from JDK 1.4 to 1.5

2007-01-10 Thread Peter Hendry
Thanks for the response. Changing to     final SecretKey unwrappedKey = (SecretKey)cipher.decryptKey(encryptedKey, XMLCipher.TRIPLEDES); does make it work! This leads onto the issue of how the receiver knows the symmetric key algorithm? This information is not transmitted in the EncryptedKey.