Error in ReadEncryptedMail.java

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Error in ReadEncryptedMail.java

Manuela Vergerio
-----------------------------------------------------------  
 From: Manuela Vergerio [hidden email]  
 To: [hidden email]  
 Subject: Error in ReadEncryptedMail.java

Hi all,
I always found an error in executing ReadEncryptedMail.java class.
Without any type of error I generate my file "encrypted.message" with CreateEncryptedMail.java and then I want to read this file using ReadEncryptedMail.java but I always have this exception:


Exception in thread "main" java.lang.IllegalArgumentException: unknown object in getInstanceFromTagged
at org.bouncycastle.asn1.ASN1Sequence.getInstance(ASN1Sequence.java:85)
at org.bouncycastle.asn1.cms.OriginatorInfo.getInstance(OriginatorInfo.java:69)
at org.bouncycastle.asn1.cms.EnvelopedData.<init>(EnvelopedData.java:69)
at org.bouncycastle.asn1.cms.EnvelopedData.getInstance(EnvelopedData.java:115)
at org.bouncycastle.cms.CMSEnvelopedData.<init>(CMSEnvelopedData.java:71)
at org.bouncycastle.cms.CMSEnvelopedData.<init>(CMSEnvelopedData.java:62)
at org.bouncycastle.mail.smime.SMIMEEnveloped.<init>(SMIMEEnveloped.java:47)
at org.bouncycastle.mail.smime.examples.ReadEncryptedMail.main(ReadEncryptedMail.java:94)

What's wrong?
- It's not a problem generated by my code modifications because I tried the same operations using the original crypto-129 package and classes and I always have the same exception.
- I don't change "encrypted.message" file's position from the folder that CreateEncryptedMail.java put it

Thanks in advance.
Best regards.
Manuela
------------------------------------------------------------------

Reply | Threaded
Open this post in threaded view
|

Re: Error in ReadEncryptedMail.java

David Hook-4

This generally indicates that the encrypted.message file is corrupted in
some way - for example the Content-Transfer-Encoding is not base64 and
it should be, or the body of the message has been corrupted.

If you want to send me the message file I'll take a look at it. The
examples certainly appear to be working here, and they haven't been
touched in a long time.

Regards,

David

On Sun, 2005-08-28 at 18:01 +0200, manuela.vergerio wrote:

> -----------------------------------------------------------  
>  From: Manuela Vergerio [hidden email]  
>  To: [hidden email]  
>  Subject: Error in ReadEncryptedMail.java
>
> Hi all,
> I always found an error in executing ReadEncryptedMail.java class.
> Without any type of error I generate my file "encrypted.message" with CreateEncryptedMail.java and then I want to read this file using ReadEncryptedMail.java but I always have this exception:
>
>
> Exception in thread "main" java.lang.IllegalArgumentException: unknown object in getInstanceFromTagged
> at org.bouncycastle.asn1.ASN1Sequence.getInstance(ASN1Sequence.java:85)
> at org.bouncycastle.asn1.cms.OriginatorInfo.getInstance(OriginatorInfo.java:69)
> at org.bouncycastle.asn1.cms.EnvelopedData.<init>(EnvelopedData.java:69)
> at org.bouncycastle.asn1.cms.EnvelopedData.getInstance(EnvelopedData.java:115)
> at org.bouncycastle.cms.CMSEnvelopedData.<init>(CMSEnvelopedData.java:71)
> at org.bouncycastle.cms.CMSEnvelopedData.<init>(CMSEnvelopedData.java:62)
> at org.bouncycastle.mail.smime.SMIMEEnveloped.<init>(SMIMEEnveloped.java:47)
> at org.bouncycastle.mail.smime.examples.ReadEncryptedMail.main(ReadEncryptedMail.java:94)
>
> What's wrong?
> - It's not a problem generated by my code modifications because I tried the same operations using the original crypto-129 package and classes and I always have the same exception.
> - I don't change "encrypted.message" file's position from the folder that CreateEncryptedMail.java put it
>
> Thanks in advance.
> Best regards.
> Manuela
> ------------------------------------------------------------------
>


Reply | Threaded
Open this post in threaded view
|

Re: Error in ReadEncryptedMail.java

motyus
Hallo all,
I get always the same exception and I tried to run
"*org.bouncycastle.mail.smime.test*",
but all 28 tests of them are failed.
The other tests in BC (like "**.cms.test*", "**.asn1.test*",
"*crypto.test*" & "*jce.provider.test*")
run properly without errors nor failures.

There is always an exception at me, everytime the construction
"*SMIMEEnveloped*" or "*SMIMESigned*" is called/used.

Does anyone has an idea to solve this problem.

Best regards,
moti

------ErrorMessageAttached------
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
org.bouncycastle.mail.smime.test.SMIMESignedTest.testSHA1WithRSA(SMIMESignedTest.java:161)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
java.lang.ClassCastException
    at org.bouncycastle.asn1.cms.SignedData.<init>(SignedData.java:99)
    at org.bouncycastle.asn1.cms.SignedData.getInstance(SignedData.java:40)
    at org.bouncycastle.cms.CMSSignedData.<init>(CMSSignedData.java:152)
    at org.bouncycastle.cms.CMSSignedData.<init>(CMSSignedData.java:136)
    at org.bouncycastle.mail.smime.SMIMESigned.<init>(SMIMESigned.java:128)
    at
org.bouncycastle.mail.smime.test.SMIMESignedTest.testSHA1WithRSAEncapsulated(SMIMESignedTest.java:227)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
java.lang.ClassCastException
    at org.bouncycastle.asn1.cms.SignedData.<init>(SignedData.java:99)
    at org.bouncycastle.asn1.cms.SignedData.getInstance(SignedData.java:40)
    at org.bouncycastle.cms.CMSSignedData.<init>(CMSSignedData.java:145)
    at org.bouncycastle.cms.CMSSignedData.<init>(CMSSignedData.java:126)
    at org.bouncycastle.mail.smime.SMIMESigned.<init>(SMIMESigned.java:90)
    at
org.bouncycastle.mail.smime.test.SMIMESignedTest.testMD5WithRSA(SMIMESignedTest.java:284)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
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
org.bouncycastle.mail.smime.test.SMIMESignedTest.testSHA224WithRSA(SMIMESignedTest.java:341)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
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
org.bouncycastle.mail.smime.test.SMIMESignedTest.testSHA1withDSA(SMIMESignedTest.java:404)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
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
org.bouncycastle.mail.smime.test.SMIMESignedTest.testSHA256WithRSABinary(SMIMESignedTest.java:478)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
org.bouncycastle.cms.CMSException: IOException reading content.
    at
org.bouncycastle.cms.CMSSignedData.readContentInfo(CMSSignedData.java:86)
    at org.bouncycastle.cms.CMSSignedData.<init>(CMSSignedData.java:136)
    at org.bouncycastle.mail.smime.SMIMESigned.<init>(SMIMESigned.java:128)
    at
org.bouncycastle.mail.smime.test.SMIMESignedTest.testCertificateManagement(SMIMESignedTest.java:533)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
org.bouncycastle.cms.CMSException: IOException reading content.
    at
org.bouncycastle.cms.CMSEnvelopedData.readContentInfo(CMSEnvelopedData.java:47)
    at
org.bouncycastle.cms.CMSEnvelopedData.<init>(CMSEnvelopedData.java:62)
    at
org.bouncycastle.mail.smime.SMIMEEnveloped.<init>(SMIMEEnveloped.java:41)
    at
org.bouncycastle.mail.smime.test.SMIMEEnvelopedTest.testDESEDE3Encrypted(SMIMEEnvelopedTest.java:118)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
org.bouncycastle.cms.CMSException: IOException reading content.
    at
org.bouncycastle.cms.CMSEnvelopedData.readContentInfo(CMSEnvelopedData.java:47)
    at
org.bouncycastle.cms.CMSEnvelopedData.<init>(CMSEnvelopedData.java:62)
    at
org.bouncycastle.mail.smime.SMIMEEnveloped.<init>(SMIMEEnveloped.java:41)
    at
org.bouncycastle.mail.smime.test.SMIMEEnvelopedTest.testIDEAEncrypted(SMIMEEnvelopedTest.java:175)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
org.bouncycastle.cms.CMSException: IOException reading content.
    at
org.bouncycastle.cms.CMSEnvelopedData.readContentInfo(CMSEnvelopedData.java:47)
    at
org.bouncycastle.cms.CMSEnvelopedData.<init>(CMSEnvelopedData.java:62)
    at
org.bouncycastle.mail.smime.SMIMEEnveloped.<init>(SMIMEEnveloped.java:41)
    at
org.bouncycastle.mail.smime.test.SMIMEEnvelopedTest.testRC2Encrypted(SMIMEEnvelopedTest.java:233)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
org.bouncycastle.cms.CMSException: IOException reading content.
    at
org.bouncycastle.cms.CMSEnvelopedData.readContentInfo(CMSEnvelopedData.java:47)
    at
org.bouncycastle.cms.CMSEnvelopedData.<init>(CMSEnvelopedData.java:62)
    at
org.bouncycastle.mail.smime.SMIMEEnveloped.<init>(SMIMEEnveloped.java:41)
    at
org.bouncycastle.mail.smime.test.SMIMEEnvelopedTest.testCASTEncrypted(SMIMEEnvelopedTest.java:291)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
org.bouncycastle.cms.CMSException: IOException reading content.
    at
org.bouncycastle.cms.CMSEnvelopedData.readContentInfo(CMSEnvelopedData.java:47)
    at
org.bouncycastle.cms.CMSEnvelopedData.<init>(CMSEnvelopedData.java:62)
    at
org.bouncycastle.mail.smime.SMIMEEnveloped.<init>(SMIMEEnveloped.java:41)
    at
org.bouncycastle.mail.smime.test.SMIMEEnvelopedTest.testSubKeyId(SMIMEEnvelopedTest.java:357)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
org.bouncycastle.cms.CMSException: IOException reading content.
    at
org.bouncycastle.cms.CMSEnvelopedData.readContentInfo(CMSEnvelopedData.java:47)
    at
org.bouncycastle.cms.CMSEnvelopedData.<init>(CMSEnvelopedData.java:62)
    at
org.bouncycastle.mail.smime.SMIMEEnveloped.<init>(SMIMEEnveloped.java:41)
    at
org.bouncycastle.mail.smime.test.SMIMEEnvelopedTest.testCapEncrypt(SMIMEEnvelopedTest.java:423)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
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
org.bouncycastle.mail.smime.test.SMIMECompressedTest.testSHA1WithRSA(SMIMECompressedTest.java:183)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
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
org.bouncycastle.mail.smime.test.SMIMESignedTest.testSHA1WithRSA(SMIMESignedTest.java:161)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
java.lang.ClassCastException
    at org.bouncycastle.asn1.cms.SignedData.<init>(SignedData.java:99)
    at org.bouncycastle.asn1.cms.SignedData.getInstance(SignedData.java:40)
    at org.bouncycastle.cms.CMSSignedData.<init>(CMSSignedData.java:152)
    at org.bouncycastle.cms.CMSSignedData.<init>(CMSSignedData.java:136)
    at org.bouncycastle.mail.smime.SMIMESigned.<init>(SMIMESigned.java:128)
    at
org.bouncycastle.mail.smime.test.SMIMESignedTest.testSHA1WithRSAEncapsulated(SMIMESignedTest.java:227)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
java.lang.ClassCastException
    at org.bouncycastle.asn1.cms.SignedData.<init>(SignedData.java:99)
    at org.bouncycastle.asn1.cms.SignedData.getInstance(SignedData.java:40)
    at org.bouncycastle.cms.CMSSignedData.<init>(CMSSignedData.java:145)
    at org.bouncycastle.cms.CMSSignedData.<init>(CMSSignedData.java:126)
    at org.bouncycastle.mail.smime.SMIMESigned.<init>(SMIMESigned.java:90)
    at
org.bouncycastle.mail.smime.test.SMIMESignedTest.testMD5WithRSA(SMIMESignedTest.java:284)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
.
.
.
------end------

David Hook wrote:

>This generally indicates that the encrypted.message file is corrupted in
>some way - for example the Content-Transfer-Encoding is not base64 and
>it should be, or the body of the message has been corrupted.
>
>If you want to send me the message file I'll take a look at it. The
>examples certainly appear to be working here, and they haven't been
>touched in a long time.
>
>Regards,
>
>David
>
>On Sun, 2005-08-28 at 18:01 +0200, manuela.vergerio wrote:
>  
>
>>-----------------------------------------------------------  
>> From: Manuela Vergerio [hidden email]  
>> To: [hidden email]  
>> Subject: Error in ReadEncryptedMail.java
>>
>>Hi all,
>>I always found an error in executing ReadEncryptedMail.java class.
>>Without any type of error I generate my file "encrypted.message" with CreateEncryptedMail.java and then I want to read this file using ReadEncryptedMail.java but I always have this exception:
>>
>>
>>Exception in thread "main" java.lang.IllegalArgumentException: unknown object in getInstanceFromTagged
>>at org.bouncycastle.asn1.ASN1Sequence.getInstance(ASN1Sequence.java:85)
>>at org.bouncycastle.asn1.cms.OriginatorInfo.getInstance(OriginatorInfo.java:69)
>>at org.bouncycastle.asn1.cms.EnvelopedData.<init>(EnvelopedData.java:69)
>>at org.bouncycastle.asn1.cms.EnvelopedData.getInstance(EnvelopedData.java:115)
>>at org.bouncycastle.cms.CMSEnvelopedData.<init>(CMSEnvelopedData.java:71)
>>at org.bouncycastle.cms.CMSEnvelopedData.<init>(CMSEnvelopedData.java:62)
>>at org.bouncycastle.mail.smime.SMIMEEnveloped.<init>(SMIMEEnveloped.java:47)
>>at org.bouncycastle.mail.smime.examples.ReadEncryptedMail.main(ReadEncryptedMail.java:94)
>>
>>What's wrong?
>>- It's not a problem generated by my code modifications because I tried the same operations using the original crypto-129 package and classes and I always have the same exception.
>>- I don't change "encrypted.message" file's position from the folder that CreateEncryptedMail.java put it
>>
>>Thanks in advance.
>>Best regards.
>>Manuela
>>------------------------------------------------------------------
>>
>>    
>>
>
>
>
>  
>


Reply | Threaded
Open this post in threaded view
|

Re: Error in ReadEncryptedMail.java

motyus
I guess, the problem is somewhere else, because the problem still persists.
These are the tools I'm using:
- *j2sdk1.4.2_09* || *j2re1.4.2_09*
- *eclipse 3.0*
- *bcprov-jdk14-129.jar*
- *bcmail-jdk14-129.jar*
- *bctest-jdk14-129.jar*
- *junit 3.8.1*
- *JavaBeans(TM) Activation Framework (JAF) 1.0.2*
- *javamail 1.3.3* (the finalRelease since yesterday)
- *Java(TM) Cryptography Extension (JCE 1.4.2)*

I added
"*security.provider.6=org.bouncycastle.jce.provider.BouncyCastleProvider*"
in
"*C:\Program Files\Java\j2re1.4.2_09\lib\security\java.security*" and
"*C:\j2sdk1.4.2_09\jre\lib\security\**java.security*".

I have also already replaced the *local_policy.jar* &
*US_export_policy.jar* in my both paths with the jar files from JCE.
About BCProv, BCMail, junit, JAF, and javamail, I defined them as
classpaths in eclipse.
I have also tried running it in "*cmd*" manually, and it gave the same
errors.

I hope you wouldn't mind, explaining, how you configured yours and which
version you used.

Best regards
-moti-


David Hook wrote:

>Funny, I'm having a conversation about something similar with someone
>else. Have you tried JavaMail 1.3.3 - it's just come out, apparently it
>fixes a Base64 decoding problem that some people have been experiencing.
>
>http://java.sun.com/products/javamail/downloads/
>
>Regards,
>
>David
>
>On Thu, 2005-09-01 at 12:26 +0200, motyus wrote:
>  
>
>>Hallo all,
>>I get always the same exception and I tried to run
>>"*org.bouncycastle.mail.smime.test*",
>>but all 28 tests of them are failed.
>>The other tests in BC (like "**.cms.test*", "**.asn1.test*",
>>"*crypto.test*" & "*jce.provider.test*")
>>run properly without errors nor failures.
>>
>>There is always an exception at me, everytime the construction
>>"*SMIMEEnveloped*" or "*SMIMESigned*" is called/used.
>>
>>Does anyone has an idea to solve this problem.
>>
>>Best regards,
>>moti
>>------------------------------------------------------------------
>>    
>>


Reply | Threaded
Open this post in threaded view
|

RE: Error in ReadEncryptedMail.java

Andrew Paterson-2
In reply to this post by Manuela Vergerio
Moti,

I had a problem with the test harness for our product failing if both
JavaMail (Sun's mail classes) and the BouncyCastle mail (bcmail) classes
were installed. Unless you need something from bcmail, you could try
removing the bcmail jar from lib/ext (or from the classpath depending on
how you are using it).

HTH

Andrew
All opinions are completely my own - after all, who else would want to
take credit for them?

Reply | Threaded
Open this post in threaded view
|

RE: Error in ReadEncryptedMail.java

Andrew Paterson-2
In reply to this post by Manuela Vergerio
David,

You asked:
> would you be able to provide me with more information on this

I am pleased to report that I have just tried it with the latest
released version (1.29) of bcmail and it worked with no problems. I
guess that whatever the problem was has been fixed.

FYI, the details of the problems as far as I can remember were: Windows
JDK 1.4.2 with JavaMail 1.3.2 installed in lib/ext. One test failed to
find a Sun class (javax.mail.MessagingException, I think) which was
definitely in mail.jar and a Secure Mime test just hung. Sorry I cannot
give you more information but, as I did not need bcmail and removing it
solved the problem, I did not take much note at the time.

Regards,
Andrew

All opinions are completely my own - after all, who else would want to
take credit for them?