All,

There a couple of issues with encryption sample -

1) With JDK 1.5, if you use the latest version of BC above SunJCE in java.security, the encryption sample fails to decrypt with the exception below. Also, 8 errors are observed while running encryption unit tests with this setup. I would guess that there's some problem with the latest BC provider jar for JDK 1.5. Note that, with the default SunJCE provider no such exceptions are observed.

[Decrypter] javax.crypto.BadPaddingException: pad block corrupted
[Decrypter] at org.bouncycastle.jce.provider.JCEBlockCipher.engineDoFinal(JCEBlockCipher.java:549)
[Decrypter] at javax.crypto.Cipher.doFinal(DashoA12275)
[Decrypter] at org.apache.xml.security.encryption.XMLCipher.decryptToByteArray(Unknown Source)
[Decrypter] at org.apache.xml.security.encryption.XMLCipher.decryptElement(Unknown Source)
[Decrypter] at org.apache.xml.security.encryption.XMLCipher.doFinal(Unknown Source)
[Decrypter] at org.apache.xml.security.samples.encryption.Decrypter.main(Unknown Source)


2) This seems to be a regression in xml-security. Using (JDK1.4.2 + BC) OR JDK1.5, the result of decryption in the sample seems incorrect. The input to be encrypted was

   <apache:RootElement xmlns:apache="http://www.apache.org/ns/#app1";>
   <apache:foo>Some simple text</apache:foo>
   </apache:RootElement>

and the output after decryption is

   <apache:RootElement xmlns:apache="http://www.apache.org/ns/#app1";>

<apache:foo xmlns:apache="http://www.apache.org/ns/#app1";>Some simple text</apache:foo>
<apache:foo xmlns:apache="http://www.apache.org/ns/#app1";>Some simple text</apache:foo>
</apache:RootElement>



Vishal

Reply via email to