# getting a java error while encryption an email

**URL:** <https://community.ciphermail.com/t/getting-a-java-error-while-encryption-an-email/24>\
**Category:** Gateway\
**Created:** [July 9, 2009, 7:18am UTC](https://community.ciphermail.com/t/getting-a-java-error-while-encryption-an-email/24 "2009-07-09T07:18:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andreas\_Schubert](https://avatars.discourse-cdn.com/v4/letter/a/f4b2a3/32.png) [@Andreas\_Schubert](https://community.ciphermail.com/u/Andreas_Schubert)\
**Post date:** [July 9, 2009, 7:18am UTC](https://community.ciphermail.com/t/getting-a-java-error-while-encryption-an-email/24/1 "2009-07-09T07:18:52Z")

</div>

hello,

i have a problem with encrypting email that was send to an external user.

i have read the administrator and smime guide, and had no problem with the basic  
setup.  
i installed the Djigzo VMware virtual appliance 1.2.3  
at this time i had created a CA, an internal domain, an internal user and a  
external user.  
the encryption mode for this external user is set mandatory and on the Select  
encryption certificates page the certificate is shown in green colour.  
but when i send an email from the internal user to the external user i will get  
these error massage in the MPA log:

09 Jul 2009 08:40:30 | ERROR IOException.  
(mitm.application.djigzo.james.mailets.SMIMEEncrypt) [Spool Thread #2]  
org.bouncycastle.mail.smime.SMIMEEnvelopedGenerator$WrappingIOException:  
org.bouncycastle.cms.CMSException: key invalid in message. at  
org.bouncycastle.mail.smime.SMIMEEnvelopedGenerator$ContentEncryptor.write(Unknown  
Source) at  
org.bouncycastle.mail.smime.handlers.PKCS7ContentHandler.writeTo(Unknown Source)  
at javax.activation.ObjectDataContentHandler.writeTo(Unknown Source) at  
javax.activation.DataHandler.writeTo(Unknown Source) at  
javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1381) at  
javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1742) at  
javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1718) at  
mitm.common.mail.MailUtils.validateMessage(MailUtils.java:207)  
at  
mitm.application.djigzo.james.mailets.SMIMEEncrypt.serviceMail(SMIMEEncrypt.java:259)  
at  
mitm.application.djigzo.james.mailets.AbstractDjigzoMailet.service(AbstractDjigzoMailet.java:226)  
at org.apache.james.transport.LinearProcessor.service(LinearProcessor.java:424)  
at  
org.apache.james.transport.JamesSpoolManager.process(JamesSpoolManager.java:405)  
at org.apache.james.transport.JamesSpoolManager.run(JamesSpoolManager.java:309)  
at java.lang.Thread.run(Thread.java:636)Caused by:  
org.bouncycastle.cms.CMSException: key invalid in message. at  
org.bouncycastle.cms.CMSEnvelopedDataStreamGenerator.open(Unknown Source) at  
org.bouncycastle.mail.smime.SMIMEEnvelopedGenerator$EnvelopedGenerator.open(Unknown  
Source) at org.bouncycastle.cms.CMSEnvelopedDataStreamGenerator.open(Unknown  
Source) at org.bouncycastle.cms.CMSEnvelopedDataStreamGenerator.open(Unknown  
Source) ... 14 moreCaused by: java.security.InvalidKeyException: Illegal key  
size at javax.crypto.Cipher.checkCryptoPerm(Cipher.java:972) at  
javax.crypto.Cipher.checkCryptoPerm(Cipher.java:993) at  
javax.crypto.Cipher.init(Cipher.java:1394) ... 18 more

what ist going wrong?

regards

Andreas Schubert  
Dipl.-Ing. (FH)  
Leiter EDV  
Tel. +49 7121 9463-360  
Fax +49 7121 9463-150  
Transline Deutschland Dr.-Ing. Sturz GmbH

Transline Deutschland ist ein Unternehmen der Sturz Gruppe (www.sturz-gruppe.de)

> **···**
>
> ---------------------------------------------------------------------------  
> Prozessautomatisierung - als Antwort auf die Krise!
> 
> [http://www.transline.de/prozess-automatisierung](http://www.transline.de/prozess-automatisierung)
> 
> Vereinbaren Sie einen Termin mit uns!  
> ---------------------------------------------------------------------------  
> \* [http://www.transline-group.com](http://www.transline-group.com) \* Ihr Partner für Globale Kommunikation  
> \* [http://www.transline.de](http://www.transline.de) \* Ihr Partner für Übersetzungen  
> \* [http://www.doculine.com](http://www.doculine.com) \* Ihr Partner für Technische Dokumentation
> 
> Am Heilbrunnen 47 \* D-72766 Reutlingen \* Germany  
> Telefon +49 7121 9463-0 \* Fax +49 7121 9463-150  
> Skype: translinedeutschland  
> Geschäftsführer: Dr.-Ing. Wolfgang Sturz  
> Eingetragen beim Amtsgericht Stuttgart HRB 353333  
> VAT ID no. DE 193439222  
> ---------------------------------------------------------------------------

---

<div class="post-metadata">

**Author:** ![martijn](https://dub1.discourse-cdn.com/flex017/user_avatar/community.ciphermail.com/martijn/32/127_2.png) [@martijn](https://community.ciphermail.com/u/martijn)\
**Post date:** [July 9, 2009, 7:28am UTC](https://community.ciphermail.com/t/getting-a-java-error-while-encryption-an-email/24/2 "2009-07-09T07:28:03Z")

</div>

Hi Andreas,

Are you 100% sure you installed the "Java Unlimited Strength  
Jurisdiction Policy Files"?

You can check if the jce policy file is correctly installed by opening  
the JCE policy manager in Djigzo (Admin -\> JCE Policy)

Is the JCE policy correctly installed?

If you installed it did you restart Djigzo? (it need to restart after  
the install of the jce policy files)

Kind regards,

Martijn Brinkers

Andreas Schubert wrote:

> **···**
>
> > hello,
> > 
> > i have a problem with encrypting email that was send to an external user.
> > 
> > i have read the administrator and smime guide, and had no problem with the basic  
> > setup.  
> > i installed the Djigzo VMware virtual appliance 1.2.3  
> > at this time i had created a CA, an internal domain, an internal user and a  
> > external user.  
> > the encryption mode for this external user is set mandatory and on the Select  
> > encryption certificates page the certificate is shown in green colour.  
> > but when i send an email from the internal user to the external user i will get  
> > these error massage in the MPA log:
> > 
> > 09 Jul 2009 08:40:30 | ERROR IOException.  
> > (mitm.application.djigzo.james.mailets.SMIMEEncrypt) [Spool Thread #2]  
> > org.bouncycastle.mail.smime.SMIMEEnvelopedGenerator$WrappingIOException:  
> > org.bouncycastle.cms.CMSException: key invalid in message. at  
> > org.bouncycastle.mail.smime.SMIMEEnvelopedGenerator$ContentEncryptor.write(Unknown  
> > Source) at  
> > org.bouncycastle.mail.smime.handlers.PKCS7ContentHandler.writeTo(Unknown Source)  
> > at javax.activation.ObjectDataContentHandler.writeTo(Unknown Source) at  
> > javax.activation.DataHandler.writeTo(Unknown Source) at  
> > javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1381) at  
> > javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1742) at  
> > javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1718) at  
> > mitm.common.mail.MailUtils.validateMessage(MailUtils.java:207)  
> > at  
> > mitm.application.djigzo.james.mailets.SMIMEEncrypt.serviceMail(SMIMEEncrypt.java:259)  
> > at  
> > mitm.application.djigzo.james.mailets.AbstractDjigzoMailet.service(AbstractDjigzoMailet.java:226)  
> > at org.apache.james.transport.LinearProcessor.service(LinearProcessor.java:424)  
> > at  
> > org.apache.james.transport.JamesSpoolManager.process(JamesSpoolManager.java:405)  
> > at org.apache.james.transport.JamesSpoolManager.run(JamesSpoolManager.java:309)  
> > at java.lang.Thread.run(Thread.java:636)Caused by:  
> > org.bouncycastle.cms.CMSException: key invalid in message. at  
> > org.bouncycastle.cms.CMSEnvelopedDataStreamGenerator.open(Unknown Source) at  
> > org.bouncycastle.mail.smime.SMIMEEnvelopedGenerator$EnvelopedGenerator.open(Unknown  
> > Source) at org.bouncycastle.cms.CMSEnvelopedDataStreamGenerator.open(Unknown  
> > Source) at org.bouncycastle.cms.CMSEnvelopedDataStreamGenerator.open(Unknown  
> > Source) ... 14 moreCaused by: java.security.InvalidKeyException: Illegal key  
> > size at javax.crypto.Cipher.checkCryptoPerm(Cipher.java:972) at  
> > javax.crypto.Cipher.checkCryptoPerm(Cipher.java:993) at  
> > javax.crypto.Cipher.init(Cipher.java:1394) ... 18 more
> > 
> > what ist going wrong?
> > 
> > regards
> > 
> > Andreas Schubert  
> > Dipl.-Ing. (FH)  
> > Leiter EDV  
> > Tel. +49 7121 9463-360  
> > Fax +49 7121 9463-150  
> > Transline Deutschland Dr.-Ing. Sturz GmbH
> > 
> > Transline Deutschland ist ein Unternehmen der Sturz Gruppe (www.sturz-gruppe.de)  
> > ---------------------------------------------------------------------------  
> > Prozessautomatisierung - als Antwort auf die Krise!
> > 
> > [Transline: Ihr Übersetzungsdienstleister für anspruchsvolle Sprachprojekte | Transline – Übersetzen. Verstehen.](http://www.transline.de/prozess-automatisierung)
> > 
> > Vereinbaren Sie einen Termin mit uns!  
> > ---------------------------------------------------------------------------  
> > \* [http://www.transline-group.com](http://www.transline-group.com) \* Ihr Partner für Globale Kommunikation  
> > \* [http://www.transline.de](http://www.transline.de) \* Ihr Partner für Übersetzungen  
> > \* [http://www.doculine.com](http://www.doculine.com) \* Ihr Partner für Technische Dokumentation
> > 
> > Am Heilbrunnen 47 \* D-72766 Reutlingen \* Germany  
> > Telefon +49 7121 9463-0 \* Fax +49 7121 9463-150  
> > Skype: translinedeutschland  
> > Geschäftsführer: Dr.-Ing. Wolfgang Sturz  
> > Eingetragen beim Amtsgericht Stuttgart HRB 353333  
> > VAT ID no. DE 193439222  
> > ---------------------------------------------------------------------------
> > 
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > Users mailing list  
> > Users(a)lists.djigzo.com  
> > [http://lists.djigzo.com/lists/listinfo/users](http://lists.djigzo.com/lists/listinfo/users)
> 
> --  
> Djigzo open source email encryption
