Beginning Cryptography with Java - SMIME problems

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Beginning Cryptography with Java - SMIME problems

DanD
Hi,

I've been running through the SMIME examples found in the book and found
some of the Signed Mail examples not working on my configuration:

The thrown exception:
org.bouncycastle.cms.CMSException: IOException reading content.
      at org.bouncycastle.cms.CMSSignedData.readContentInfo(
CMSSignedData.java:86)
      at org.bouncycastle.cms.CMSSignedData.<init>(CMSSignedData.java:126)
      at org.bouncycastle.mail.smime.SMIMESigned.<init>(SMIMESigned.java:90
)
      at chapter9.SignedMailExample.main(SignedMailExample.java:85)

The underlying Exception:
java.io.IOException: DER length more than 4 bytes
      at org.bouncycastle.asn1.ASN1InputStream.readLength(
ASN1InputStream.java:72)
      at org.bouncycastle.asn1.ASN1InputStream.readObject(
ASN1InputStream.java:349)
      at org.bouncycastle.asn1.ASN1InputStream.readObject(
ASN1InputStream.java:362)
      at org.bouncycastle.asn1.ASN1InputStream.readObject(
ASN1InputStream.java:426)
      at org.bouncycastle.asn1.ASN1InputStream.readObject(
ASN1InputStream.java:362)
      at org.bouncycastle.cms.CMSSignedData.readContentInfo(
CMSSignedData.java:82)
      at org.bouncycastle.cms.CMSSignedData.<init>(CMSSignedData.java:126)
      at org.bouncycastle.mail.smime.SMIMESigned.<init>(SMIMESigned.java:90
)
      at chapter9.SignedMailExample.main(SignedMailExample.java:85)

the code is what ships with the book in chapter9.SignedMailExample.

My configuration:

Eclipse 3.1.0, jdk 1.5.0_04, jaf 1.0.2, javamail 1.3.3, bcmail-jdk15-129,
bcprov-jdk15-129.jar (in the ext dir)

security.provider.1=sun.security.provider.Sun
security.provider.2=sun.security.rsa.SunRsaSign
security.provider.3=com.sun.net.ssl.internal.ssl.Provider
security.provider.4=com.sun.crypto.provider.SunJCE
security.provider.5=sun.security.jgss.SunProvider
security.provider.6=com.sun.security.sasl.Provider
security.provider.7=org.bouncycastle.jce.provider.BouncyCastleProvider