开发者

Problem verifying signed mail with bouncycastle API only in axis2 webservice environment

here's my very strange problem :

I wrote a ws that checks a signed mail with bouncycastle API. When I test the method outside axis2 environment, all works fine. As soon as i've deployed the ws in tomcat, all goes wrong. I've got a strange exception that I've localized in the bc api, in the readObject() method, when the api try to cast the mime message to asn1 structure. Here's the exception :

Caused by: org.bouncycastle.cms.CMSException: IOException reading content.
    at org.bouncycastle.cms.CMSUtils.readContentInfo(Unknown Source)
    at org.bouncycastle.cms.CMSUtils.readContentInfo(Unknown Source)
    at org.bouncycastle.cms.CMSSignedData.<init>(Unknown Source)
    at org.bouncycastle.mail.smime.SMIMESigned.<init>(Unknown Source)
... 32 more
Caused by: java.io.EOFException: EOF found when length expected
    at org.bouncycastle.asn1.ASN1InputStream.readLength(Unknown Source)
    at org.bouncycastle.asn1.ASN1InputStream.readLength(Unknown Source)
    at org.bouncycastle.asn1.ASN1InputStream.readObject(Unknown Source

The exception is raised when i call the SignedMailValidator constructor.

private static SignBean verifySignedMail(MimeMessage msg, PKIXParameters param, Log log)
            throws SarvaraExc开发者_运维技巧eption
   {
      String errorSubject = "";
      String errorDetails = "";
      SignBean signReturn = new SignBean();
      // set locale for the output
      Locale loc = Locale.FRENCH;
      // Locale loc = Locale.GERMAN;
      // validate signatures
      SignedMailValidator validator;
      try
      {
         validator = new SignedMailValidator(msg, param);
         ...

I dont think the problem comes from the code I wrote because everything's ok oustide axis2 environment. I'm really stuck and I've found nothing about that anywhere. By the way, the MimeMessage constructor takes the Sytem properties in parameter and to be sure that was not the point, I've put exactly the same System properties in both environment (standalone prog and axis2 ws). Every suggestions would be welcome. Thanks you all.


Ok, I've found the problem, and that's really strange... As soon as I remove the geronimo-javamail librarie from the tomcat classpath, all goes well... I really dont know what is the problem with this librarie but the fact is tomcat felt better without it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜