我正在使用BouncyCastle / SmimeUtils(https://github.com/markenwerk/java-utils-mail-smime)对加密的电子邮件进行解密。除来自一个特定客户端的电子邮件外,所有电子邮件均被解密,没有任何问题。
MimeMessage decrypted = SmimeUtil.decrypt(message.getSession(), message, getSmimeKey(user);
解密来自该客户端的电子邮件时,我得到以下信息:
Caused by: java.io.IOException: unknown tag 28 encountered
at org.bouncycastle.asn1.ASN1InputStream.buildObject(Unknown Source) ~[bcprov-jdk15on-1.56.jar:1.56.0]
at org.bouncycastle.asn1.ASN1InputStream.readObject(Unknown Source) ~[bcprov-jdk15on-1.56.jar:1.56.0]
at org.bouncycastle.cms.CMSUtils.readContentInfo(Unknown Source) ~[bcpkix-jdk15on-1.56.jar:1.56.0.0]
at org.bouncycastle.cms.CMSUtils.readContentInfo(Unknown Source) ~[bcpkix-jdk15on-1.56.jar:1.56.0.0]
at org.bouncycastle.cms.CMSEnvelopedData.<init>(Unknown Source) ~[bcpkix-jdk15on-1.56.jar:1.56.0.0]
所说的电子邮件经过加密和签名。 Outlook / Thunderbird可以成功读取它们。