[WSS4J] Exception in WSEncryptBody

"Dimuthu Leelarathne." <[email protected]> Tue, 10 Feb 2004 08:18:49 +0600
Newsgroups gmane.text.xml.wss4j
Message-ID <001601c3ef7c$38cba840$e308f8c0@common>
This is a multi-part message in MIME format.

------=_NextPart_000_0013_01C3EFAE.82B82500
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi all,

I am getting "NoSuchPaddingException" exception from WSEncryptBody when =
I try to run the doAll sample.

WSDoAllSender: Encryption: error during message =
processingorg.apache.xml.security.encryption.XMLEncryptionException:=20
Paddding: ISO10126PADDING not implemented
Original Exception was javax.crypto.NoSuchPaddingException: Paddding: =
ISO10126PADDING not implemented

The exception occur in the client side.=20
I studied the code carefully and found out the following.

1) The exception is thrown from=20

java class :: org.apache.ws.security.message.WSEncryptBody
metod     :: pulic Document build(Document doc, Crypto crypto) throws =
Exception
line no    :: 274

                     SecretKey symmetricKey =3D null;
                     KeyGenerator keyGen =3D getKeyGenerator();
                     symmetricKey =3D keyGen.generateKey();
   here ------>   XMLCipher xmlCipher =3D =
XMLCipher.getInstance(symEncAlgo/*, encCanonAlgo */);
                     xmlCipher.init(XMLCipher.ENCRYPT_MODE, =
symmetricKey);


It looks like the problem is with XMLCipher.getInstance(symEncAlgo). It =
throws this NoSuchPaddingException.


This exception is caught at DoAllSender line no :: 322
I have given the stack trace at the end of the mail.

2) I get this excetpion if I build the code using ant1.5.2 and eclipse.
But When I build the code using Jbuilder I do not get the error.=20
I am using the same set of jars in every occasion.=20
I am really, really confused about this point. I am really, really stuck =
here.

3) The stack trace is ::

WSDoAllSender: Encryption: error during message =
processingorg.apache.xml.security.encryption.XMLEncryptionException: =
Paddding: ISO10126PADDING not implemented
Original Exception was javax.crypto.NoSuchPaddingException: Paddding: =
ISO10126PADDING not implemented
 at =
org.apache.ws.axis.security.WSDoAllSender.invoke(WSDoAllSender.java:322)
 at =
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.ja=
va:71)
 at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:157)
 at org.apache.axis.SimpleChain.invoke(SimpleChain.java:122)
 at org.apache.axis.client.AxisClient.invoke(AxisClient.java:164)
 at org.apache.axis.client.Call.invokeEngine(Call.java:2682)
 at org.apache.axis.client.Call.invoke(Call.java:2665)
 at org.apache.axis.client.Call.invoke(Call.java:2355)
 at org.apache.axis.client.Call.invoke(Call.java:2278)
 at org.apache.axis.client.Call.invoke(Call.java:1772)
 at =
org.apache.ws.axis.samples.wssec.doall.axisSec.SecBindingStub.secSend(Sec=
BindingStub.java:104)
 at org.apache.ws.axis.samples.wssec.doall.Tester.main(Tester.java:54)


I've been struggling with this problem for sometime now.
=20
Your help is appreciated very much. Thanking in advance,

Best Regards,
Dimuthu.

------=_NextPart_000_0013_01C3EFAE.82B82500
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi all,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I am =
getting&nbsp;"NoSuchPaddingException"=20
exception from WSEncryptBody when I try to run the doAll =
sample.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>WSDoAllSender: Encryption: error during =
message=20
processingorg.apache.xml.security.encryption.XMLEncryptionException:=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Paddding: ISO10126PADDING not=20
implemented<BR>Original Exception was =
javax.crypto.NoSuchPaddingException:=20
Paddding: ISO10126PADDING not implemented</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The exception occur in the client side. =

</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I studied the code carefully and found =
out the=20
following.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>1) The exception is thrown from =
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>java class ::=20
org.apache.ws.security.message.WSEncryptBody<BR>metod &nbsp;&nbsp;&nbsp; =
::=20
pulic Document build(Document doc, Crypto crypto) throws =
Exception<BR>line=20
no&nbsp;&nbsp;&nbsp; :: 274</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;SecretKey =

symmetricKey =3D null;<BR>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; KeyGenerator =
keyGen =3D=20
getKeyGenerator();<BR>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; symmetricKey =
=3D=20
keyGen.generateKey();<BR>&nbsp;&nbsp; here ------&gt;&nbsp;&nbsp; =
XMLCipher=20
xmlCipher =3D XMLCipher.getInstance(symEncAlgo/*, encCanonAlgo=20
*/);<BR>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
xmlCipher.init(XMLCipher.ENCRYPT_MODE,=20
symmetricKey);</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>It looks like the problem is with=20
XMLCipher.getInstance(symEncAlgo). It throws this=20
NoSuchPaddingException.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>This exception is caught at DoAllSender =
line no ::=20
322<BR>I have given the stack trace at the end of the mail.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV><FONT face=3DArial =
size=3D2>
<DIV>2) I get this excetpion if I build the code using ant1.5.2 and=20
eclipse.<BR>But When I build the code using Jbuilder I do not get the =
error.=20
<BR>I am using the same set of jars&nbsp;in every occasion. </DIV>
<DIV>I am really, really confused about this point. I am really, really =
stuck=20
here.</DIV>
<DIV>&nbsp;</DIV>
<DIV>3) The stack trace is ::</DIV>
<DIV>&nbsp;</DIV>
<DIV>WSDoAllSender: Encryption: error during message=20
processingorg.apache.xml.security.encryption.XMLEncryptionException: =
Paddding:=20
ISO10126PADDING not implemented<BR>Original Exception was=20
javax.crypto.NoSuchPaddingException: Paddding: ISO10126PADDING not=20
implemented<BR>&nbsp;at=20
org.apache.ws.axis.security.WSDoAllSender.invoke(WSDoAllSender.java:322)<=
BR>&nbsp;at=20
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.ja=
va:71)<BR>&nbsp;at=20
org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:157)<BR>&nbsp;at =

org.apache.axis.SimpleChain.invoke(SimpleChain.java:122)<BR>&nbsp;at=20
org.apache.axis.client.AxisClient.invoke(AxisClient.java:164)<BR>&nbsp;at=
=20
org.apache.axis.client.Call.invokeEngine(Call.java:2682)<BR>&nbsp;at=20
org.apache.axis.client.Call.invoke(Call.java:2665)<BR>&nbsp;at=20
org.apache.axis.client.Call.invoke(Call.java:2355)<BR>&nbsp;at=20
org.apache.axis.client.Call.invoke(Call.java:2278)<BR>&nbsp;at=20
org.apache.axis.client.Call.invoke(Call.java:1772)<BR>&nbsp;at=20
org.apache.ws.axis.samples.wssec.doall.axisSec.SecBindingStub.secSend(Sec=
BindingStub.java:104)<BR>&nbsp;at=20
org.apache.ws.axis.samples.wssec.doall.Tester.main(Tester.java:54)</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR>I've been struggling with this problem for sometime now.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Your help is appreciated very much. Thanking in advance,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Best Regards,<BR>Dimuthu.</FONT></DIV></BODY></HTML>

------=_NextPart_000_0013_01C3EFAE.82B82500--



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn